Description Usage Arguments Value Author(s) Examples
Extract the p.value from a model fit.
1 |
x |
an object from coxph, surdiff, any result of class htest, which you get from most of the built in ‘*.test’ functions. see examples. |
... |
currently unused. |
a numeric(1) containing the p-value. If x
is a
survdiff
object, then the result is the
chi-squared p.value (see survival:::summary.survfit). If
x
is a code
object, then the result is the
likelihood ratio p.value (see survival:::summary.coxph).
Mark Cowley
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | # example from t.test
a <- t.test(1:10,y=c(7:20))
p.value(a)
# [1] 1.855282e-05
# example from prop.test
heads <- rbinom(1, size=100, prob = .5)
a <- prop.test(heads, 100)
p.value(a)
# [1] 0.9203443
# example from survdiff
if( require(survival) ) {
a <- survdiff(Surv(futime, fustat) ~ rx,data=ovarian)
p.value(a)
# [1] 0.302591
}
# example from coxph
if( require(survival) ) {
test1 <- list(time=c(4,3,1,1,2,2,3),
status=c(1,1,1,0,1,1,0),
x=c(0,2,1,1,1,0,0),
sex=c(0,0,0,0,1,1,1))
a <- coxph(Surv(time, status) ~ x + strata(sex), test1)
p.value(a)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.