Question: Cox proportional hazards regression model for multistate model.
0
gravatar for solisruiz.j
3 months ago by
solisruiz.j0 wrote:

I have similar data in the following format:

id  start   end event   sex biomarker
1   0   2.3 0   M   0.52
1   2.3 4.5 0   M   0.02
2   0   0.5 0   F   0.75
2   0.5 1   1   F   0.55
3   0   2   0   F   0.56
3   2   3.9 0   F   0.11
4   0   1   0   M   0.43
4   1   2.8 1   M   0.28

I am running the following code after importing reading in my data for a Cox proportional hazards regression model for multistate model:

model1 <- coxph(Surv(data$'start', data$'event')~ data$sex + data$biomarker, id=data$id, data=data)

However, I get the following error:

Error in coxph(Surv(data$'start', data$'event') ~ data$sex + data$biomarker, id = data$id, : Argument id not matched
Traceback:

1. coxph(Surv(data$'start', data$'event') ~ data$sex + data$biomarker, id = data$data$id, 
 .     data)
2. stop(gettextf("Argument %s not matched", names(extraArgs)[indx == 
 .     0L]), domain = NA)

I also tried it in Rgui and got the following error:

Error in coxph(Surv(df$time, df$event) ~  df$sex + df$biomarker, data = df, id = df$id) : 
  object 'id' not found

Is there something I am missing?

survival cox R • 201 views
ADD COMMENTlink written 3 months ago by solisruiz.j0

What is the output of str(data)?

Perhaps you just need to do:

model1 <- coxph(Surv(start, event, data = data)~ sex + biomarker, id = 'id', data = data)
ADD REPLYlink written 3 months ago by Kevin Blighe71k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 2071 users visited in the last hour
_