The psfmi package contains a function to conduct stability analyses of logistic, Cox and Mixed models. With this function the stability of models selected and the bootstrap inclusion frequency can be evaluated. For logistic and Cox regression models bootstrapping is than used and for Multilevel models cluster bootstrapping.
library(psfmi)
<- psfmi_lr(data=lbpmilr, nimp=5, impvar="Impnr", Outcome="Chronic",
psfmi_res predictors=c("Gender", "Smoking", "JobControl", "Age", "Duration",
"JobDemands", "SocialSupport"), p.crit =0.157, method="MPR",
cat.predictors = "Satisfaction", int.predictors = c("Gender:JobControl"),
direction = "BW")
#> Removed at Step 1 is - Smoking
#> Removed at Step 2 is - Duration
#> Removed at Step 3 is - JobDemands
#> Removed at Step 4 is - factor(Satisfaction)
#> Removed at Step 5 is - Gender*JobControl
#> Removed at Step 6 is - JobControl
#> Removed at Step 7 is - SocialSupport
#> Removed at Step 8 is - Age
#>
#> Selection correctly terminated,
#> No more variables removed from the model
<- psfmi_stab(psfmi_res, direction="FW", start_model = TRUE,
stab_res boot_method = "single", nboot=20, p.crit=0.05)
#>
#> Boot 1
#>
#> Selection correctly terminated,
#> No new variables entered the model
#>
#> Boot 2
#> Entered at Step 1 is - Gender
#>
#> Selection correctly terminated,
#> No new variables entered the model
#>
#> Boot 3
#> Entered at Step 1 is - Gender
#>
#> Selection correctly terminated,
#> No new variables entered the model
#>
#> Boot 4
#>
#> Selection correctly terminated,
#> No new variables entered the model
#>
#> Boot 5
#>
#> Selection correctly terminated,
#> No new variables entered the model
#>
#> Boot 6
#>
#> Selection correctly terminated,
#> No new variables entered the model
#>
#> Boot 7
#>
#> Selection correctly terminated,
#> No new variables entered the model
#>
#> Boot 8
#>
#> Selection correctly terminated,
#> No new variables entered the model
#>
#> Boot 9
#>
#> Selection correctly terminated,
#> No new variables entered the model
#>
#> Boot 10
#> Entered at Step 1 is - Age
#>
#> Selection correctly terminated,
#> No new variables entered the model
#>
#> Boot 11
#> Entered at Step 1 is - Gender
#>
#> Selection correctly terminated,
#> No new variables entered the model
#>
#> Boot 12
#>
#> Selection correctly terminated,
#> No new variables entered the model
#>
#> Boot 13
#>
#> Selection correctly terminated,
#> No new variables entered the model
#>
#> Boot 14
#>
#> Selection correctly terminated,
#> No new variables entered the model
#>
#> Boot 15
#> Entered at Step 1 is - Age
#>
#> Selection correctly terminated,
#> No new variables entered the model
#>
#> Boot 16
#> Entered at Step 1 is - Gender
#>
#> Selection correctly terminated,
#> No new variables entered the model
#>
#> Boot 17
#>
#> Selection correctly terminated,
#> No new variables entered the model
#>
#> Boot 18
#> Entered at Step 1 is - Gender
#>
#> Selection correctly terminated,
#> No new variables entered the model
#>
#> Boot 19
#>
#> Selection correctly terminated,
#> No new variables entered the model
#>
#> Boot 20
#>
#> Selection correctly terminated,
#> No new variables entered the model
$bif
stab_res#> Gender Smoking JobControl Age Duration JobDemands SocialSupport
#> boot 1 0 0 0 0 0 0 0
#> boot 2 1 0 0 0 0 0 0
#> boot 3 1 0 0 0 0 0 0
#> boot 4 0 0 0 0 0 0 0
#> boot 5 0 0 0 0 0 0 0
#> boot 6 0 0 0 0 0 0 0
#> boot 7 0 0 0 0 0 0 0
#> boot 8 0 0 0 0 0 0 0
#> boot 9 0 0 0 0 0 0 0
#> boot 10 0 0 0 1 0 0 0
#> boot 11 1 0 0 0 0 0 0
#> boot 12 0 0 0 0 0 0 0
#> boot 13 0 0 0 0 0 0 0
#> boot 14 0 0 0 0 0 0 0
#> boot 15 0 0 0 1 0 0 0
#> boot 16 1 0 0 0 0 0 0
#> boot 17 0 0 0 0 0 0 0
#> boot 18 1 0 0 0 0 0 0
#> boot 19 0 0 0 0 0 0 0
#> boot 20 0 0 0 0 0 0 0
#> factor(Satisfaction) Gender*JobControl
#> boot 1 0 0
#> boot 2 0 0
#> boot 3 0 0
#> boot 4 0 0
#> boot 5 0 0
#> boot 6 0 0
#> boot 7 0 0
#> boot 8 0 0
#> boot 9 0 0
#> boot 10 0 0
#> boot 11 0 0
#> boot 12 0 0
#> boot 13 0 0
#> boot 14 0 0
#> boot 15 0 0
#> boot 16 0 0
#> boot 17 0 0
#> boot 18 0 0
#> boot 19 0 0
#> boot 20 0 0
$bif_perc
stab_res#> Gender Smoking JobControl
#> 25 0 0
#> Age Duration JobDemands
#> 10 0 0
#> SocialSupport factor(Satisfaction) Gender*JobControl
#> 0 0 0
$model_stab
stab_res#> Gender Smoking JobControl Age Duration JobDemands SocialSupport
#> 1 0 0 0 0 0 0 0
#> 2 1 0 0 0 0 0 0
#> 3 0 0 0 1 0 0 0
#> factor(Satisfaction) Gender*JobControl freq bif_pat_perc
#> 1 0 0 13 65
#> 2 0 0 5 25
#> 3 0 0 2 10
Back to Examples
library(psfmi)
<- psfmi_coxr(formula = Surv(Time, Status) ~ Pain + factor(Satisfaction) + rcs(Tampascale,3) +
pool_lr + Radiation*factor(Satisfaction) + Age + Duration + Previous +
Radiation *rcs(Tampascale, 3), data=lbpmicox, p.crit = 0.157, direction="FW",
Radiationnimp=5, impvar="Impnr", keep.predictors = NULL, method="D1")
#> Entered at Step 1 is - Pain
#> Entered at Step 2 is - Duration
#> Entered at Step 3 is - rcs(Tampascale,3)
#>
#> Selection correctly terminated,
#> No new variables entered the model
$RR_Model
pool_lr#> NULL
$multiparm
pool_lr#> $`Step 0 - selected - Pain`
#> p-value D1
#> Pain 0.002972173
#> Radiation 0.181042842
#> Age 0.351345242
#> Duration 0.044028841
#> Previous 0.714681296
#> factor(Satisfaction) 0.708284253
#> rcs(Tampascale,3) 0.032223680
#> factor(Satisfaction)*Radiation 0.712860014
#> rcs(Tampascale,3)*Radiation 0.452891382
#>
#> $`Step 1 - selected - Duration`
#> p-value D1
#> Radiation 0.31938607
#> Age 0.22333023
#> Duration 0.04853205
#> Previous 0.54425893
#> factor(Satisfaction) 0.76439993
#> rcs(Tampascale,3) 0.07594972
#> factor(Satisfaction)*Radiation 0.66328781
#> rcs(Tampascale,3)*Radiation 0.44642240
#>
#> $`Step 2 - selected - rcs(Tampascale,3)`
#> p-value D1
#> Radiation 0.32679294
#> Age 0.40528789
#> Previous 0.44216497
#> factor(Satisfaction) 0.81050733
#> rcs(Tampascale,3) 0.06066281
#> factor(Satisfaction)*Radiation 0.70440131
#> rcs(Tampascale,3)*Radiation 0.35955920
<- psfmi_stab(pool_lr, direction="FW", start_model = TRUE,
stab_res boot_method = "single", nboot=20, p.crit=0.05)
#>
#> Boot 1
#> Entered at Step 1 is - Pain
#>
#> Selection correctly terminated,
#> No new variables entered the model
#>
#> Boot 2
#> Entered at Step 1 is - Pain
#>
#> Selection correctly terminated,
#> No new variables entered the model
#>
#> Boot 3
#>
#> Selection correctly terminated,
#> No new variables entered the model
#>
#> Boot 4
#>
#> Selection correctly terminated,
#> No new variables entered the model
#>
#> Boot 5
#> Entered at Step 1 is - Pain
#>
#> Selection correctly terminated,
#> No new variables entered the model
#>
#> Boot 6
#> Entered at Step 1 is - Pain
#>
#> Selection correctly terminated,
#> No new variables entered the model
#>
#> Boot 7
#>
#> Selection correctly terminated,
#> No new variables entered the model
#>
#> Boot 8
#> Entered at Step 1 is - Pain
#>
#> Selection correctly terminated,
#> No new variables entered the model
#>
#> Boot 9
#>
#> Selection correctly terminated,
#> No new variables entered the model
#>
#> Boot 10
#>
#> Selection correctly terminated,
#> No new variables entered the model
#>
#> Boot 11
#> Entered at Step 1 is - Pain
#>
#> Selection correctly terminated,
#> No new variables entered the model
#>
#> Boot 12
#> Entered at Step 1 is - Pain
#>
#> Selection correctly terminated,
#> No new variables entered the model
#>
#> Boot 13
#>
#> Selection correctly terminated,
#> No new variables entered the model
#>
#> Boot 14
#>
#> Selection correctly terminated,
#> No new variables entered the model
#>
#> Boot 15
#> Entered at Step 1 is - rcs(Tampascale,3)
#>
#> Selection correctly terminated,
#> No new variables entered the model
#>
#> Boot 16
#>
#> Selection correctly terminated,
#> No new variables entered the model
#>
#> Boot 17
#> Entered at Step 1 is - Pain
#>
#> Selection correctly terminated,
#> No new variables entered the model
#>
#> Boot 18
#>
#> Selection correctly terminated,
#> No new variables entered the model
#>
#> Boot 19
#> Entered at Step 1 is - Pain
#>
#> Selection correctly terminated,
#> No new variables entered the model
#>
#> Boot 20
#> Entered at Step 1 is - Pain
#>
#> Selection correctly terminated,
#> No new variables entered the model
$bif
stab_res#> Pain Radiation Age Duration Previous factor(Satisfaction)
#> boot 1 1 0 0 0 0 0
#> boot 2 1 0 0 0 0 0
#> boot 3 0 0 0 0 0 0
#> boot 4 0 0 0 0 0 0
#> boot 5 1 0 0 0 0 0
#> boot 6 1 0 0 0 0 0
#> boot 7 0 0 0 0 0 0
#> boot 8 1 0 0 0 0 0
#> boot 9 0 0 0 0 0 0
#> boot 10 0 0 0 0 0 0
#> boot 11 1 0 0 0 0 0
#> boot 12 1 0 0 0 0 0
#> boot 13 0 0 0 0 0 0
#> boot 14 0 0 0 0 0 0
#> boot 15 0 0 0 0 0 0
#> boot 16 0 0 0 0 0 0
#> boot 17 1 0 0 0 0 0
#> boot 18 0 0 0 0 0 0
#> boot 19 1 0 0 0 0 0
#> boot 20 1 0 0 0 0 0
#> rcs(Tampascale,3) factor(Satisfaction)*Radiation
#> boot 1 0 0
#> boot 2 0 0
#> boot 3 0 0
#> boot 4 0 0
#> boot 5 0 0
#> boot 6 0 0
#> boot 7 0 0
#> boot 8 0 0
#> boot 9 0 0
#> boot 10 0 0
#> boot 11 0 0
#> boot 12 0 0
#> boot 13 0 0
#> boot 14 0 0
#> boot 15 1 0
#> boot 16 0 0
#> boot 17 0 0
#> boot 18 0 0
#> boot 19 0 0
#> boot 20 0 0
#> rcs(Tampascale,3)*Radiation
#> boot 1 0
#> boot 2 0
#> boot 3 0
#> boot 4 0
#> boot 5 0
#> boot 6 0
#> boot 7 0
#> boot 8 0
#> boot 9 0
#> boot 10 0
#> boot 11 0
#> boot 12 0
#> boot 13 0
#> boot 14 0
#> boot 15 0
#> boot 16 0
#> boot 17 0
#> boot 18 0
#> boot 19 0
#> boot 20 0
$bif_perc
stab_res#> Pain Radiation
#> 50 0
#> Age Duration
#> 0 0
#> Previous factor(Satisfaction)
#> 0 0
#> rcs(Tampascale,3) factor(Satisfaction)*Radiation
#> 5 0
#> rcs(Tampascale,3)*Radiation
#> 0
$model_stab
stab_res#> Pain Radiation Age Duration Previous factor(Satisfaction) rcs(Tampascale,3)
#> 1 1 0 0 0 0 0 0
#> 2 0 0 0 0 0 0 0
#> 3 0 0 0 0 0 0 1
#> factor(Satisfaction)*Radiation rcs(Tampascale,3)*Radiation freq bif_pat_perc
#> 1 0 0 10 50
#> 2 0 0 9 45
#> 3 0 0 1 5
Back to Examples