# Introduction

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.

# Examples

## Pooling without BS and method D1

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",
"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.9845108 1.0001342
#> 2  0.9278136 0.6855705 1.2556522
#> 3  0.9105225 0.6435046 1.2883376
#> 4  1.0449397 1.0106267 1.0804177
#> 5  0.9911858 0.9762151 1.0063861
#> 6  0.9063322 0.6117408 1.3427877
#> 7  0.9770006 0.9501492 1.0046109
#> 8  0.9916555 0.9754881 1.0080908
#> 9  0.9783958 0.9488992 1.0088093
#> 10 0.9499476 0.9043761 0.9978154
#> 11 1.2754457 0.8082175 2.0127772
#> 12 1.2548993 0.8452496 1.8630856

Back to Examples

## Pooling with FS and method MPR


library(psfmi)
pool_coxr <- psfmi_coxr(data=lbpmicox, nimp=5, impvar="Impnr", time="Time", status="Status",
"Previous", "Tampascale"), p.crit=0.05,
cat.predictors=c("Expect_cat"), method="MPR", 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.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.9848108 0.9993821
#> 2 1.0266655 1.0912048

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 with FS including interaction terms and method D1 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.9844091 0.9990955 #> 2 0.9575624 1.0094108 #> 3 1.0179701 1.0861332 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
#> 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 with BS including spline coefficients and method D1

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",
p.crit=0.05, cat.predictors=c("Satisfaction"), spline.predictors=c("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.9843763 0.9990502
#> 2 0.001104361 1.0568545 1.0226366 1.0922174
#> 3 0.017380618 0.9364698 0.8873345 0.9883259
#> 4 0.048860903 1.0612279 1.0003023 1.1258642

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 with FS including spline coefficients and method MPR Pooling Cox regression models over 5 imputed datasets with forward selection using a p-value of 0.05 and as method MPR including a restricted cubic spline predictor and forcing Tampascale in the models during forward 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="MPR", 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 #> 1 Duration -0.00834864 0.00375033 -2.226108 186.9008 #> 2 rcs(Tampascale, 3)Tampascale -0.06563800 0.02724068 -2.409558 129.2769 #> 3 rcs(Tampascale, 3)Tampascale' 0.05942661 0.02982168 1.992732 106.0096 #> 4 Function 0.05529708 0.01668254 3.314668 184.6679 #> p.value HR lower.EXP upper.EXP #> 1 0.027201742 0.9916861 0.9843763 0.9990502 #> 2 0.017380618 0.9364698 0.8873345 0.9883259 #> 3 0.048860903 1.0612279 1.0003023 1.1258642 #> 4 0.001104361 1.0568545 1.0226366 1.0922174 pool_coxr$predictors_in
#>          Duration Previous Radiation Onset Function factor(Satisfaction)
#> Step 1          0        0         0     0        1                    0
#> Step 2          1        0         0     0        0                    0
#> Included        1        0         0     0        1                    0
#> Included                 1                           0