With the psfmi
package you can pool Cox regression models by using
the following pooling methods: RR (Rubin’s Rules), D1, D2, and MPR
(Median R Rule). You can also use forward or backward selection from
the pooled model. This vignette show you examples of how to apply these
procedures.
If you set p.crit at 1 than no selection of variables takes place. Either using direction = “FW” or direction = “BW” will produce the same result.
library(psfmi)
pool_coxr <- psfmi_coxr(data=lbpmicox, nimp=5, impvar="Impnr", time="Time", status="Status",
predictors=c("Duration", "Radiation", "Onset", "Function", "Age",
"Previous", "Tampascale", "JobControl", "JobDemand", "Social"), p.crit=1,
cat.predictors=c("Expect_cat"), method="D1", direction = "BW")
pool_coxr$RR_model
#> $`Step 1 - no variables removed -`
#> term estimate std.error statistic df p.value
#> 1 Duration -0.007738082 0.003989357 -1.9396814 178.7494 0.05399243
#> 2 Radiation -0.074924387 0.153336031 -0.4886287 178.9424 0.62570287
#> 3 Onset -0.093736647 0.175892468 -0.5329202 179.0136 0.59474977
#> 4 Function 0.043959177 0.016917684 2.5984159 175.2854 0.01016263
#> 5 Age -0.008853266 0.007712097 -1.1479713 177.7066 0.25252344
#> 6 Previous -0.098349421 0.199199997 -0.4937220 178.0134 0.62211113
#> 7 Tampascale -0.023267973 0.014089917 -1.6513918 133.5549 0.10100803
#> 8 JobControl -0.008379513 0.008329969 -1.0059477 178.6831 0.31580101
#> 9 JobDemand -0.021840998 0.015512484 -1.4079626 178.3078 0.16088320
#> 10 Social -0.051348486 0.024912588 -2.0611462 178.3036 0.04074068
#> 11 factor(Expect_cat)2 0.243295714 0.231183479 1.0523923 177.6191 0.29404919
#> 12 factor(Expect_cat)3 0.227055353 0.200259380 1.1338063 178.6187 0.25839523
#> HR lower.EXP upper.EXP
#> 1 0.9922918 0.9845632 1.0000811
#> 2 0.9278136 0.6869711 1.2530922
#> 3 0.9105225 0.6450123 1.2853263
#> 4 1.0449397 1.0108591 1.0801694
#> 5 0.9911858 0.9763160 1.0062821
#> 6 0.9063322 0.6133734 1.3392136
#> 7 0.9770006 0.9503887 1.0043577
#> 8 0.9916555 0.9755964 1.0079789
#> 9 0.9783958 0.9490959 1.0086002
#> 10 0.9499476 0.9046771 0.9974834
#> 11 1.2754457 0.8107270 2.0065470
#> 12 1.2548993 0.8475097 1.8581172
Back to Examples
library(psfmi)
pool_coxr <- psfmi_coxr(data=lbpmicox, nimp=5, impvar="Impnr", time="Time", status="Status",
predictors=c("Duration", "Radiation", "Onset", "Function", "Age",
"Previous", "Tampascale"), p.crit=0.05,
cat.predictors=c("Expect_cat"), method="MPR", direction = "FW")
#> Registered S3 methods overwritten by 'car':
#> method from
#> influence.merMod lme4
#> cooks.distance.influence.merMod lme4
#> dfbeta.influence.merMod lme4
#> dfbetas.influence.merMod lme4
#> Entered at Step 1 is - Function
#> Entered at Step 2 is - Duration
#>
#> Selection correctly terminated,
#> No new variables entered the model
pool_coxr$RR_model_final
#> $`Final model`
#> term estimate std.error statistic df p.value HR
#> 1 Duration -0.007961913 0.003722934 -2.138612 189.0119 0.0337507152 0.9920697
#> 2 Function 0.056799291 0.015453322 3.675539 189.0119 0.0003091121 1.0584434
#> lower.EXP upper.EXP
#> 1 0.984857 0.9993353
#> 2 1.026865 1.0909925
pool_coxr$predictors_in
#> Duration Radiation Onset Function Age Previous Tampascale
#> Step 1 0 0 0 1 0 0 0
#> Step 2 1 0 0 0 0 0 0
#> Included 1 0 0 1 0 0 0
#> factor(Expect_cat)
#> Step 1 0
#> Step 2 0
#> Included 0
Back to Examples
Pooling Cox regression models over 5 imputed datasets with backward selection using a p-value of 0.05 and as method D2 including interaction terms with a categorical predictor and forcing the predictor Tampascale in the models during backward selection.
library(psfmi)
pool_coxr <- psfmi_coxr(data=lbpmicox, nimp=5, impvar="Impnr", time="Time", status="Status",
predictors=c("Duration", "Previous", "Radiation", "Onset",
"Function", "Tampascale" ), p.crit=0.05, cat.predictors=c("Satisfaction",
"Expect_cat"), int.predictors=c("Tampascale:Radiation",
"Expect_cat:Tampascale"), keep.predictors = "Tampascale", method="D1", direction = "FW")
#> Entered at Step 1 is - Function
#> Entered at Step 2 is - Duration
#>
#> Selection correctly terminated,
#> No new variables entered the model
pool_coxr$RR_model_final
#> $`Final model`
#> term estimate std.error statistic df p.value HR
#> 1 Duration -0.008309329 0.003753484 -2.213765 187.9452 0.028047868 0.9917251
#> 2 Tampascale -0.016998788 0.013360456 -1.272321 177.6436 0.204921997 0.9831449
#> 3 Function 0.050217190 0.016427330 3.056930 187.0360 0.002563622 1.0514994
#> lower.EXP upper.EXP
#> 1 0.9844559 0.999048
#> 2 0.9577339 1.009230
#> 3 1.0181830 1.085906
pool_coxr$predictors_in
#> Duration Previous Radiation Onset Function Tampascale
#> Step 1 0 0 0 0 1 1
#> Step 2 1 0 0 0 0 1
#> Included 1 0 0 0 1 1
#> factor(Satisfaction) factor(Expect_cat) Tampascale*Radiation
#> Step 1 0 0 0
#> Step 2 0 0 0
#> Included 0 0 0
#> factor(Expect_cat)*Tampascale
#> Step 1 0
#> Step 2 0
#> Included 0
Back to Examples
Pooling Cox regression models over 5 imputed datasets with backward selection using a p-value of 0.05 and as method D1 including a restricted cubic spline predictor and forcing Tampascale in the models during backward selection.
library(psfmi)
pool_coxr <- psfmi_coxr(data=lbpmicox, nimp=5, impvar="Impnr", time="Time", status="Status",
predictors=c("Duration", "Previous", "Radiation", "Onset", "Function"),
p.crit=0.05, cat.predictors=c("Satisfaction"), spline.predictors=c("Tampascale"),
int.predictors=c("Tampascale:Radiation"), keep.predictors = "Tampascale",
nknots=3, method="D1", direction = "BW")
#> Removed at Step 1 is - factor(Satisfaction)
#> Removed at Step 2 is - rcs(Tampascale,3)*Radiation
#> Removed at Step 3 is - Onset
#> Removed at Step 4 is - Radiation
#> Removed at Step 5 is - Previous
#>
#> Selection correctly terminated,
#> No more variables removed from the model
pool_coxr$RR_model_final
#> $`Step 6`
#> term estimate std.error statistic df
#> 1 Duration -0.00834864 0.00375033 -2.226108 186.9008
#> 2 Function 0.05529708 0.01668254 3.314668 184.6679
#> 3 rcs(Tampascale, 3)Tampascale -0.06563800 0.02724068 -2.409558 129.2769
#> 4 rcs(Tampascale, 3)Tampascale' 0.05942661 0.02982168 1.992732 106.0096
#> p.value HR lower.EXP upper.EXP
#> 1 0.027201742 0.9916861 0.9844233 0.9990025
#> 2 0.001104361 1.0568545 1.0228566 1.0919825
#> 3 0.017380618 0.9364698 0.8877814 0.9878284
#> 4 0.048860903 1.0612279 1.0009766 1.1251058
pool_coxr$predictors_out
#> Duration Previous Radiation Onset Function factor(Satisfaction)
#> Step 1 0 0 0 0 0 1
#> Step 2 0 0 0 0 0 0
#> Step 3 0 0 0 1 0 0
#> Step 4 0 0 1 0 0 0
#> Step 5 0 1 0 0 0 0
#> Removed 0 1 1 1 0 1
#> rcs(Tampascale,3) rcs(Tampascale,3)*Radiation
#> Step 1 0 0
#> Step 2 0 1
#> Step 3 0 0
#> Step 4 0 0
#> Step 5 0 0
#> Removed 0 1
Back to Examples
Pooling Cox regression models over 5 imputed datasets with backward selection using a p-value of 0.05 and as method D1 including a restricted cubic spline predictor and forcing Tampascale in the models during backward selection.
library(psfmi)
pool_coxr <- psfmi_coxr(data=lbpmicox, nimp=5, impvar="Impnr", time="Time", status="Status",
predictors=c("Duration", "Previous", "Radiation", "Onset", "Function"),
p.crit=0.05, cat.predictors=c("Satisfaction"), spline.predictors=c("Tampascale"),
int.predictors=c("Tampascale:Radiation"), keep.predictors = "Tampascale",
nknots=3, method="D1", direction = "MPR")
pool_coxr$RR_model_final
#> NULL
pool_coxr$predictors_in
#> NULL
Back to Examples