[R] plot for "survreg" and "intcox" (rewritten)
David Winsemius
dwinsemius at comcast.net
Tue Aug 26 23:57:16 CEST 2014
On Aug 26, 2014, at 2:33 PM, Silong Liao wrote:
> Dear R users,
>
> I'm trying to plot survival probability against time(in years) using "survreg" and "intcox". Please can you help me with this problem? (I have rewritten using plain text.) I tried to use "curve" function but have no clue.
>
I suspect you want survfit (in the survial package which is where I suspect survreg is coming from. It returns an object that has a plot method. You could also scroll through help(pack=survival) to see other plotting functions.
You could also use survest in the rms package.
> For survreg,
>> mod.reg1=survreg(s_new~type+sex+eye+preopiop+preopva,dist="weibull")
>> summary(mod.reg1)
> Call:
> survreg(formula = s_new ~ type + sex + eye + preopiop + preopva, dist = "weibull")
> Value Std. Error z p
> (Intercept) 40.539 20.582 1.970 4.89e-02
> typeTrab -6.606 4.279 -1.544 1.23e-01
> sexM -1.055 3.765 -0.280 7.79e-01
> eyeR -2.112 3.587 -0.589 5.56e-01
> preopiop -0.308 0.269 -1.147 2.52e-01
> preopva -0.461 1.771 -0.260 7.95e-01
> Log(scale) 2.058 0.285 7.222 5.12e-13
>
> Scale= 7.83
> Weibull distribution
> Loglik(model)= -78.7 Loglik(intercept only)= -81.4
> Chisq= 5.37 on 5 degrees of freedom, p= 0.37
> Number of Newton-Raphson Iterations: 10
> n= 339
>
> For intcox,
You are asked to provide the package name for functions that are not in the base or default packages. I have quite a few packages loaded including survival_2.37-7 , coxme_2.2-3, and rms_4.2-0 but I get:
> ?intcox
No documentation for ‘intcox’ in specified packages and libraries:
you could try ‘??intcox’
>
--
David.
>> cox.fit=intcox(s_new~type+eye+sex+age+preopiop+preopva,data=glaucoma_new)
>> summary(cox.fit)
> Call:
> intcox(formula = s_new ~ type + eye + sex + age + preopiop +preopva, data = glaucoma_new)
>
> n= 339
>
> coef exp(coef) se(coef) z Pr(>|z|)
> typeTrab 0.59391 1.81106 NA NA NA
> eyeR 0.28419 1.32868 NA NA NA
> sexM -0.11597 0.89050 NA NA NA
> age -0.06556 0.93655 NA NA NA
> preopiop 0.03903 1.03980 NA NA NA
> preopva -0.05517 0.94632 NA NA NA
>
> exp(coef) exp(-coef) lower .95 upper .95
> typeTrab 1.8111 0.5522 NA NA
> eyeR 1.3287 0.7526 NA NA
> sexM 0.8905 1.1230 NA NA
> age 0.9365 1.0678 NA NA
> preopiop 1.0398 0.9617 NA NA
> preopva 0.9463 1.0567 NA NA
>
> Rsquare= NA (max possible= 0.327 )
> Likelihood ratio test= NA on 6 df, p=NA
> Wald test = NA on 6 df, p=NA
> Score (logrank) test = NA on 6 df, p=NA
>
> ______________________________________________
> 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
Alameda, CA, USA
More information about the R-help
mailing list