coxph: Adjust coxph summary output
Split HR and CI, print logrank values.
This commit is contained in:
parent
351b26368d
commit
a3c816ad64
15
coxph.R
15
coxph.R
@ -21,20 +21,21 @@ covariates <- c("dx_age", "asct_age", "time_dx_to_asct", "sex",
|
|||||||
#
|
#
|
||||||
# Extract data from Cox PH results
|
# Extract data from Cox PH results
|
||||||
#
|
#
|
||||||
sma_cox_res <- function(x) {
|
sma_cox_res <- function(m) {
|
||||||
x <- summary(x)
|
x <- summary(m)
|
||||||
p.value<-signif(x$wald["pvalue"], digits=2)
|
p.value<-signif(x$wald["pvalue"], digits=2)
|
||||||
wald.test<-signif(x$wald["test"], digits=2)
|
wald.test<-signif(x$wald["test"], digits=2)
|
||||||
beta<-signif(x$coef[1], digits=2);#coeficient beta
|
beta<-signif(x$coef[1], digits=2);#coeficient beta
|
||||||
HR <-signif(x$coef[2], digits=2);#exp(beta)
|
HR <-signif(x$coef[2], digits=2);#exp(beta)
|
||||||
HR.confint.lower <- signif(x$conf.int[,"lower .95"], 2)
|
HR.confint.lower <- signif(x$conf.int[,"lower .95"], 2)
|
||||||
HR.confint.upper <- signif(x$conf.int[,"upper .95"],2)
|
HR.confint.upper <- signif(x$conf.int[,"upper .95"],2)
|
||||||
HR <- paste0(HR, " (",
|
HR.confint <- paste0(HR.confint.lower, "-", HR.confint.upper)
|
||||||
HR.confint.lower, "-", HR.confint.upper, ")")
|
logtest <- signif(x$logtest["test"], digits = 2)
|
||||||
|
logtest.pvalue <- x$logtest["pvalue"]
|
||||||
|
|
||||||
res<-c(beta, HR, wald.test, p.value)
|
res<-c(beta, HR, HR.confint, wald.test, p.value, logtest, logtest.pvalue)
|
||||||
names(res)<-c("beta", "HR (95% CI for HR)", "wald.test",
|
names(res)<-c("beta", "HR", "95% CI for HR", "wald test",
|
||||||
"p.value")
|
"p value", "logtest", "logtest p value")
|
||||||
return(res)
|
return(res)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user