Add `conf.level=` argument to `cuminc()` and `crr()`
Closed this issue · 4 comments
Remember to update the print method as needed
This update needs to wait until tidymodels/broom#1068 us resolved
and tidymodels/broom#1069 has been merged and a new version of broom released.
@tengfei-emory will review the changes merged in PR #46 before the next release
I compared the confidence interval results for crr
function from both tidycmprsk
and cmprsk
. The results are identical.
library(survival)
set.seed(10)
ftime <- rexp(200)
fstatus <- sample(0:2,200,replace=TRUE)
cov <- matrix(runif(600),nrow=200)
dimnames(cov)[[2]] <- c('x1','x2','x3')
z <- cmprsk::crr(ftime,fstatus,cov)
summary(z,conf.int=0.90)
#> Competing Risks Regression
#>
#> Call:
#> cmprsk::crr(ftime = ftime, fstatus = fstatus, cov1 = cov)
#>
#> coef exp(coef) se(coef) z p-value
#> x1 0.2668 1.306 0.421 0.633 0.53
#> x2 -0.0557 0.946 0.381 -0.146 0.88
#> x3 0.2805 1.324 0.381 0.736 0.46
#>
#> exp(coef) exp(-coef) 5% 95%
#> x1 1.306 0.766 0.653 2.61
#> x2 0.946 1.057 0.505 1.77
#> x3 1.324 0.755 0.707 2.48
#>
#> Num. cases = 200
#> Pseudo Log-likelihood = -320
#> Pseudo likelihood ratio test = 1.02 on 3 df,
dat <- data.frame(ftime=ftime,fstatus=fstatus,cov=cov)
dat$fstatus <- as.factor(dat$fstatus)
levels(dat$fstatus) <- c("censored","type1","type2")
tidycmprsk::crr(Surv(ftime, fstatus) ~ cov.x1 + cov.x2 + cov.x3, dat, conf.level=0.90)
#>
#> -- crr() -----------------------------------------------------------------------
#> * Call Surv(ftime, fstatus) ~ cov.x1 + cov.x2 + cov.x3
#> * Failure type of interest "type1"
#>
#> Variable Coef SE HR 90% CI p-value
#> cov.x1 0.267 0.421 1.31 0.65, 2.61 0.53
#> cov.x2 -0.056 0.381 0.95 0.51, 1.77 0.88
#> cov.x3 0.280 0.381 1.32 0.71, 2.48 0.46
Created on 2022-01-01 by the reprex package (v2.0.1)
It appears that cmprsk::cuminc
does not have confidence interval output. Therefore, I did not conduct the comparison for the confidence interval results for cuminc
function. The code looks solid and the conf.level
argument is passed to add_conf.int
function for calculation.
In summary I think the update looks fine.
I noticed that dependencies broom
and hardhat
are developmental versions. Do we also need to wait for the next release of hardhat
before our next release? Or are we only waiting for broom
?
Great, thanks for taking a look!
broom's maintainer already reviewed our PR and merged it. He also mentioned that he's submitting an update when CRAN returns from the break. That'll be a short wait!
I would be fine releasing before the hardhat release. I submitted an issue inquiring about the release schedule...let's wait to see what they're timeline is before deciding whether to wait?