1
$\begingroup$

I'm doing some survival analysis and I got the idea to change a binary variable into three-category variable by sub-dividing one category of the binary variable into two new categories. Here's a script to produce a comparable dataset:

df = data.frame(Sample = c(1:20), 
           OS_Months = sample(c(1:100),size = 20, replace = TRUE),
           OS_Event = sample(c(1,0), size = 20, replace = TRUE),
           Original_Var = sample(c("Yes","No"), size = 20, replace = TRUE),
           New_Var = sample(c(2,3), size = 20, replace = TRUE))
df[df$Original_Var == "No",]$New_Var = 1

Normally, when I do survival analysis I measure significance using a log-rank p-value for binary data and a coxph p-value for continuous data but I don't have a firm understanding of the mathematical basis for either of these test.

At this time, its not clear to me whether or not the new categories I've defined have an ordinal relationship with each other. If they do, I expect I'll have to think about how to scale them but my current hope is that treating them as categorical variables will eliminate this problem.

Specific Questions:

  1. If I decide that my variables really are ordinal, what impact will scaling have on my variables if I use the coxph model?
  2. If I decide variables are not ordinal and coxph is inappropriate, what is a more appropriate test to run?

For what its worth, the original binary variable was presence/absence of mutations in a particular gene and the new variable categorizes the mutations as belonging to one of two types. If I were to scale the numeric categories, I would probably change 2 and 3 to numbers closer to each other than to non-mutants, something along the lines of:

df[df$New_Var == 2,]$New_Var = 10
df[df$New_Var == 3,]$New_Var = 11
$\endgroup$
1
$\begingroup$

I'm not sure I understand your description but if I do, then your transformation did not create an ordinal variable. In any event, it is the predictor. Dealing with an ordinal predictor variable is not as tricky as dealing with an ordinal response. However, in your case, you probably just want to compare among them.

Cox models can deal with discrete or continuous predictors so it is not necessary to swap to log-rank unless you just prefer to do so.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.