ExpeRts, I'm trying to compare three survival curves using the function "survdiff" in the survival package. Following is my code and corresponding error message. > survdiff(Surv(st_months, status) ~ strata(BOR), data=mydata) Error in survdiff(Surv(st_months, status) ~ strata(BOR), data = mydata) : No groups to test
When I check the "strata" of the variable. I get . . . > strata(BOR) Levels: BOR=PD BOR=PR BOR=SD So I know there are levels associated with the BOR variable, but I can't seem to get the strata statement to work within "survdiff". I checked ?strata and (unless I am not understanding) the help, it seems to be working as I get the following output > levels(strata(BOR)) [1] "BOR=PD" "BOR=PR" "BOR=SD" I can get the survival tables and KM plot with no problem, but I can't seem to be able to compare the survival curves. I can get an overall comparison if I remove the "strata" statement > survdiff(Surv(st_months, status) ~ BOR, data=mydata) Call: survdiff(formula = Surv(st_months, status) ~ BOR, data = mydata) n=35, 5 observations deleted due to missingness. N Observed Expected (O-E)^2/E (O-E)^2/V BOR=PD 13 13 6.51 6.464 8.87 BOR=PR 10 10 18.48 3.888 10.59 BOR=SD 12 12 10.01 0.395 0.61 Chisq= 13.5 on 2 degrees of freedom, p= 0.00117 But when I use survdiff(Surv(st_months, status) ~ strata(BOR), data=mydata) it doesn't want to work. Any suggestions? Many thanks for your assistance! _____________________________________________ Patrick Richardson Biostatistician - Program of Translational Medicine Van Andel Research Institute - Webb Lab 333 Bostwick Avenue NE Grand Rapids, MI 49503 This email message, including any attachments, is for th...{{dropped:9}} ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.