Re: [R] basehaz and newdata

From: mah <harwood262_at_gmail.com>
Date: Wed, 16 Apr 2008 09:39:25 -0700 (PDT)

Survfit returns an "Error in temp[, 1] : incorrect number of dimensions" error message when I attempt to use newdata to validate my models. The syntax I am using is "sfit <- survfit(mod1, newdata=testd, individual=T)". The dataframe testd has two columns and 39 rows (see below). The rows are the monthly values of the independent variable in subsequent months, and the number of months. When I remove the "individual=T" option I get the 39 curves I would expect. Am I misunderstanding the intent of survfit/newdata/ individual, or is the syntax incorrect? Mod1 is the following

Call:
coxph(formula = Surv(Inv_Months) ~ sb_rat_12, data = dfname_c)

          coef exp(coef) se(coef)    z p
sb_rat_12 1.22      3.40    0.132 9.28 0

Likelihood ratio test=84.6 on 1 df, p=0 n= 8405

the dataframe testd is the following:
Inv_Months sb_rat_12

1 1.023567
2 0.989322
3 0.952052
4 0.973252
5 0.916755
6 0.891067
7 0.912577
8 0.911228
9 0.886093
10 0.875797
11 0.869389
12 0.859579
13 0.879346
14 0.89506
15 0.925471
16 0.909221
17 0.924457
18 0.967833
19 0.966343
20 0.965692
21 0.972147
22 0.974816
23 0.995564
24 0.961251
25 0.921189
26 0.90495
27 0.908382
28 0.924647
29 0.917796
30 0.841098
31 0.827645
32 0.838338
34 0.916267
36 0.993804
39 1.116348
40 1.093067
41 1.135917

45 1.322135
46 1.302194

Thanks in advance!

Mike

On Apr 8, 8:47 am, Terry Therneau <thern..._at_mayo.edu> wrote:
> The 'basehaz' function is just a wrapper forsurvfit, and includes only some of
> the arguments of the former.  It's main reason for existence is that another
> more well known (but inferior :-) package uses that term.
>
> I don't understand the final comment in the exchange, however:
>
> > I had been hoping the tedious
> > alignment of the baseline curve with the value of the variables in the
> > new data set would be [somehow] handled for me.
>
>         Terry Therneau
>
> ______________________________________________
> R-h...@r-project.org mailing listhttps://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



R-help_at_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. Received on Wed 16 Apr 2008 - 20:18:38 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 16 Apr 2008 - 20:30:50 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive