[R] Extract p-value from aftreg object
Göran Broström
goran.brostrom at gmail.com
Thu Feb 18 17:37:33 CET 2010
2010/2/18 Philipp Rappold <philipp.rappold at gmail.com>:
> Dear all,
>
> does anyone know how I can extract specific p-values for covariates from an
> aftreg object? After fitting a model with aftreg I can find all different
> variables by using str(), but there's no place where p-values are kept. The
> odd thing is that print() displays them correctly.
>
> EXAMPLE:
>
>> testdata
> start stop censor groupvar var1 var2
> 1 0 1 0 1 0.91663902 0.0847912
> 2 1 2 0 1 0.60470753 0.6487798
> 3 2 3 0 1 0.09599891 0.2195178
> 4 3 4 1 1 0.86384189 0.6667897
> 5 0 1 0 2 0.07747445 0.8782836
> 6 1 2 0 2 0.44608030 0.2218685
> 7 2 3 1 2 0.77317152 0.3813840
>
>
>> fit1 <- aftreg(Surv(start, stop, censor)~var1, data=testdata)
>
>
>> fit1
> Call:
> aftreg(formula = Surv(start, stop, censor) ~ var1, data = testdata)
>
> Covariate W.mean Coef Exp(Coef) se(Coef) Wald p
> var1 0.540 0.150 1.162 0.770 0.845
>
> log(scale) 1.358 3.890 0.260 0.000
> log(shape) 2.015 7.502 0.781 0.010
>
> Events 2
> Total time at risk 7
> Max. log. likelihood -1.4026
> LR test statistic 0.05
> Degrees of freedom 1
> Overall p-value 0.816436
> WALD P IS DISPLAYED CORRECTLY.
>
>
> Any help is highly appreciated, I'm going nuts here ;)
print.aftreg calculates the p-values like this:
pchisq(x$coef^2 / diag(x$var), 1, lower.tail = FALSE)
where x is the output from 'aftreg'. You could try the same.
Thanks
> Philipp
>
> ______________________________________________
> 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.
>
--
Göran Broström
More information about the R-help
mailing list