Anthony Nash
Anthony Nash

Reputation: 1119

How to pull out TRUE/FALSE stratum result from R cox regression?

I have the cox model:

res <- coxph(Surv(time,status)~drugName*strata(preventative),data=df)

time - integer 0 to N status - integer 0 or 1 drugName - categorical variable e.g., "drugA", "drugB" etc. preventative - boolean TRUE/FALSE

From:

summary(res)

I see results for:

drugA
drugB
drugC
drugA:strata(preventative)=TRUE
drugB:strata(preventative)=TRUE
drugC:strata(preventative)=TRUE

However, I can't seem to get out the results for the strata where preventative=FALSE.

I've been assured by a clinical epidemiologist that this is possible, however, I use R and she uses SAS.

Besides rerunning the calculation and changing the preventative term TRUE/FALSE around, how can I do this in R?

EDIT #1 As per Julius Vainora's reply.

I've now tried:

res <- coxph(Surv(time,status)~drugName*strata(preventative),data=df)

and

res <- coxph(Surv(time,status)~drugName:strata(preventative),data=df)

The respective results are:

enter image description here

and (the new suggestion)

enter image description here

If the new suggestion will help just clear the values of the categorical variable preventative, any idea why the drugNamecitaloprame in the first model has a value but NA in the second model?

Upvotes: 1

Views: 151

Answers (1)

Julius Vainora
Julius Vainora

Reputation: 48211

Your current results already include what you want: drugA corresponds to FALSE and drugA + drugA:strata(preventative)=TRUE corresponds to true. As to get the same results in a more clean way, you may run instead

coxph(Surv(time, status) ~ drugName:strata(preventative), data = df)

Upvotes: 1

Related Questions