[R] Confidence Intervals for survreg (survival)

David Winsemius dwinsemius at comcast.net
Sat Mar 7 19:55:24 CET 2015

On Mar 7, 2015, at 6:29 AM, annclaire wrote:

> Hello!
> I am trying to fit confidence intervals for my server object as well, but I
> can only get an interval estimation for the intercept coefficient and am
> getting NAs for my scale parameter.  Did you also have this issue?  
> Below is a rough outline of my code

>> newsurvobj <-Surv(studytimenew, censors)
>> newserv <- survfit(newsurvobj~1, type="kaplan-meier")
>> survreg(formula=newsurvobj~1, dist="weibull")
> Call:
> survreg(formula = newsurvobj ~ 1, dist = "weibull")
> Coefficients:
> (Intercept) 
>   2.726151 
> Scale= 0.4861742 
> Loglik(model)= -160.8   Loglik(intercept only)= -160.8
> n= 100 

I'm puzzled. First you tell `survreg` that you want a model with only an intercept term and then complain about it. Then you get a confidence interval for that parameter from `confint` and then you complain about getting NA's when you give `confint` an object that doesn't match the specifications for it in the help page. 

>> ??confint
>> survival <- survreg(formula=newsurvobj~1, dist="weibull")
>> confint(survival, level=.95)
>               2.5 %   97.5 %
> (Intercept) 2.540459 2.911843
> confint(survival, "coefficients$scale",level=.95)
>                   2.5 % 97.5 %
> coefficients$scale    NA     NA

The second parameter to `confint` is supposed to be either a term name or a number. In your case the only available name (for a model term) would be `(Intercept)`. If you want the estimated scale, you would use `summary`. Read the ?summary.survreg page. The var (vcov object) includes the log(scale) parameter.

> Thank you so much for any help you can offer!
> -Ann

Uncommenting the Nabble link:
View this message in context: http://r.789695.n4.nabble.com/Confidence-Intervals-for-survreg-survival-tp4674137p4704283.html
Sent from the R help mailing list archive at Nabble.com.

I did go there thinking I might learn something about this question and found out that it was in followup to one of mine from two years ago. You should include context for your questions and understand that Nabble is neither the Rhelp mailing list nor does it function as its Archive. And it removes these important lines which I am now attempting to put before you (again)

PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

David Winsemius
Alameda, CA, USA

More information about the R-help mailing list