[R] survreg help in R

Terry Therneau therneau at mayo.edu
Mon Mar 9 17:06:09 CET 2009


> survreg(Surv(times,censor),dist='weibull')
Error in x$terms : $ operator is invalid for atomic vectors

 You need a right-hand side for the formula
 	survreg(Surv(times, censor) ~1, dist='weibull')
 	
 In your code the first argument was not recognized as a "formula", and the 
program subsequently got very confused.  The error message was not very helpful, 
unfortunately.  
 
  FYI: from an updated help page for survreg.distributions
  
> y<-rweibull(1000, shape=2, scale=5)
> survreg(Surv(y)~1, dist="weibull")
Coefficients:
(Intercept) 
   1.607516 

Scale= 0.5187037 

 Survreg parameters are scale=1/shape, intercept=log(scale).  This is because 
the Weibull has been imbedded in a general location-scale framework.

	Terry Therneau




More information about the R-help mailing list