hr.test | R Documentation |
Hazard ratio test
hr.test(beta1, se1, beta2, se2, r = 0, n = 10000)
beta1 |
beta estimate for the first hazard ratio |
se1 |
standard error of beta estimate for the first hazard ratio |
beta2 |
standard error of beta estimate for the second hazard ratio |
se2 |
standard error of beta estimate for the second hazard ratio |
r |
correlation between the first and second risk scores (i.e., predictors) |
n |
number of samples from which the hazard ratios were estimated |
A list with class "htest" containing the following components:
statistic | the value of the t-statistic. |
parameter | the degrees of freedom for the t-statistic. |
p.value | the p-value for the test. |
conf.int | a confidence interval for the mean appropriate to the specified alternative hypothesis. |
estimate | the estimated mean or difference in means depending on whether it was a one-sample test or a two-sample test. |
null.value | the specified hypothesized value of the mean or mean difference depending on whether it was a one-sample test or a two-sample test. |
stderr | the standard error of the mean (difference), used as denominator in the t-statistic formula. |
alternative | a character string describing the alternative hypothesis. |
method | a character string indicating what type of t-test was performed. |
data.name | a character string giving the name(s) of the data. |
Currently only performs a directional test
hr.comp2
## Not run:
set.seed(12345)
age <- as.numeric(rnorm(100, 50, 10) >= 50)
size <- as.numeric(rexp(100, 1) > 1)
stime <- rexp(100)
cens <- runif(100, .5, 2)
sevent <- as.numeric(stime <= cens)
stime <- pmin(stime, cens)
coxm1 <- survival::coxph(survival::Surv(stime, sevent) ~ age)
coxm2 <- survival::coxph(survival::Surv(stime, sevent) ~ size)
hr.test(
coxm1$coefficients,
drop(sqrt(coxm1$var)),
coxm2$coefficients,
drop(sqrt(coxm2$var)),
cor(age, size),
100
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.