val.surv
On Aug 20, 2011, at 8:08 PM, Salvo Mac wrote:
Thanks David However, I tried your trick on val.surv with newdata=test['age'] but still didn't work. Still gives the same error message: Error in val.surv(f.1, newdata = test1["age"], u = 10) : dims [product 1797] do not match the length of object [2496] In addition: Warning message: In est.surv + S[, 1] : longer object length is not a multiple of shorter object length
As I said (and you did not act upon): The fundamental thing you are doing wrong for q1 is failing to unambiguously describe the test object. I said it was a guess. Now stop wasting our time and offer what is needed.
david. > > Salvo > > > > ________________________________ > From: David Winsemius <dwinsemius at comcast.net> > > Cc: "r-help at R-project.org" <r-help at r-project.org> > Sent: Sunday, August 21, 2011 12:55 AM > Subject: Re: [R] val.surv > > > On Aug 20, 2011, at 3:32 PM, Salvo Mac wrote: > >> Dear R-users, >> >> I have two questions regarding validation and calibration of >> Survival regression models. >> >> 1. I am trying to calibrate and validate a cox model using val.surv. >> here is my code: >> f.1<-cph(Surv(time,event)~age, x=T, y=T, data=train) >> test1<-test[,"age"] >> val.surv(f.1, newdata=data.frame(test1), u=10) >> >> but I get an error message: >> >> Error in val.surv(f.1, newdata = data.frame(testi), u = 10) : >> dims [product 1797] do not match the length of object [2496] >> In addition: Warning message: >> In est.surv + S[, 1] : >> longer object length is not a multiple of shorter object length >> >> I ran the example in the r-documentation but couldn't extract >> dxy from result. >> >> What am I doing wrong? > > The fundamental thing you are doing wrong for q1 is failing to > unambiguously describe the test object. I would think that if test > were a dataframe then wrapping data.frame around a vector might not > get it named correctly as 'age'. You might try newdata= test['age']. > Just a guess. > >> >> 2. In validate and calibrate cph functions. If it is frailty >> fit, does the the bootstrap resample clusters or just individuals > > The code above appears to be dependent on the rms package. The > frailty function is part of the underlying survival package and I do > not see it mentioned in the index for Harrell's RMS text. You will > probably need to wait until Frank comes across this. He is generally > very good about correction my errors and knowledge gaps. > >> > > -- > David Winsemius, MD > West Hartford, CT > [[alternative HTML version deleted]] > > ______________________________________________ > 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. David Winsemius, MD West Hartford, CT