The miceafter
package includes the function
pool_cindex
, to pool c-index values from logistic and Cox
regression models. This vignette shows you how to use this function.
mice
function and
Logistic RegressionThe lbp_orig is a dataset as part of the miceafter package with
missing values. So we first impute them with the mice
function. Than we use the mids2milist
function to turn the
mids
object with multiply imputed datasets, as a result of
using mice
, into a milist
object. Than we use
the with
function to apply repeated analyses with the
cindex
function across the multiply imputed datasets.
Finally, we pool the results by using the pool_cindex
function. We do that in one pipe.
%>%
lbp_orig mice(m=5, seed=3025, printFlag = FALSE) %>%
mids2milist() %>%
with(expr = cindex(glm(Chronic ~ Gender + Radiation, family=binomial))) %>%
pool_cindex()
#> C-index Critical value 95 CI low 95 CI high
#> [1,] 0.6553774 1.97818 0.567203 0.734012
#> attr(,"class")
#> [1] "mipool"
The dataset lbpmilr
as part of the miceafter package is
a long dataset that contains 10 multiply imputed datasets. The datasets
are distinguished by the Impnr
variable. First we convert
the dataset into a milist
object by using the
df2milist
function. Than we use the with
function to apply repeated analyses with the cindex
function across the multiply imputed datasets. Finally, we pool the
results by using the pool_cindex
function.
<- df2milist(lbpmilr, impvar = "Impnr")
imp_data
<- with(data=imp_data,
ra expr = cindex(glm(Chronic ~ Gender + Radiation, family=binomial)))
<- pool_cindex(ra)
res
res#> C-index Critical value 95 CI low 95 CI high
#> [1,] 0.6638267 1.976656 0.5764274 0.7412861
#> attr(,"class")
#> [1] "mipool"
The dataset lbpmicox
as part of the miceafter package is
a long dataset that contains 10 multiply imputed datasets. The datasets
are distinguished by the Impnr
variable. First we convert
the dataset into a milist
object by using the
df2milist
function. Than we use the with
function to apply repeated analyses with the cindex
function across the list of multiply imputed datasets. Finally, we pool
the results by using the pool_cindex
function.
library(survival)
%>%
lbpmicox df2milist(impvar = "Impnr") %>%
with(expr = cindex(coxph(Surv(Time, Status) ~ Radiation + Age))) %>%
pool_cindex()
#> C-index Critical value 95 CI low 95 CI high
#> [1,] 0.5413464 1.959964 0.4952103 0.5867842
#> attr(,"class")
#> [1] "mipool"