Mike, On Sat, May 21, 2011 at 10:15 PM, Mike Harwood <harwood...@gmail.com> wrote: > I am unsure what is being returned, and what is supposed to be > returned, when using 'predict' with "type='expected'" for an aftreg > survival model.
I'm sorry, but there is no 'predict.aftreg'. The generic 'predict' "works" because aftreg objects have a secondary class 'coxph'. This is probably a mistake (or two) that should be corrected. Thanks, Göran > The code below first generates a weibull model, then > uses predict to create a vector of the linear predictors, then > attempts to create the 'expected' vector, which is empty. The final > two steps in the code generate a lognormal model with the same data, > and the same empty 'expected' vector. > > My expectation had been that 'expected' would generate the same > transformed dependent variable output as predict with a survreg model > using type='response'. Since my 'real' data is left-truncated and > right-censored I cannot use survreg, and I wanted to investigate the > output from eha. > > Thanks in advance! > > Mike > >> data(mort) >> aftreg(Surv(enter, exit, event) ~ ses, data = mort) > Call: > aftreg(formula = Surv(enter, exit, event) ~ ses, data = mort) > > Covariate W.mean Coef Exp(Coef) se(Coef) Wald p > ses > lower 0.416 0 1 (reference) > upper 0.584 -0.348 0.706 0.089 0.000 > > log(scale) 3.603 36.698 0.065 0.000 > log(shape) 0.331 1.392 0.058 0.000 > > Events 276 > Total time at risk 17038 > Max. log. likelihood -1391.3 > LR test statistic 16.1 > Degrees of freedom 1 > Overall p-value 5.91578e-05 >> m1 <- aftreg(Surv(enter, exit, event) ~ ses, data = mort) >> head(predict(m1, type='lp')) ## produces output > 1 2 3 4 5 6 > -0.347853 0.000000 -0.347853 0.000000 0.000000 0.000000 >> head(predict(m1, type='expected')) ## is this correct? > numeric(0) >> m2 <- aftreg(Surv(enter, exit, event) ~ ses, dist='lognormal', data = mort) >> head(predict(m2, type='expected')) ## is this correct? > numeric(0) > > > from eha (the survival and rms packages are not an option for my > 'real' question, since I have left-truncated right-censored data > > ______________________________________________ > 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. > -- Göran Broström ______________________________________________ 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.