1 Stability analysis

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.

2 Examples

2.1 Stability analysis of Logistic regression model


  library(psfmi)
  psfmi_res <- psfmi_lr(data=lbpmilr, nimp=5, impvar="Impnr", Outcome="Chronic",
                      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

   stab_res <- psfmi_stab(psfmi_res, direction="FW", start_model = TRUE,
      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 - Age
#> 
#> 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
#> Entered at Step 1 is - Gender
#> 
#> Selection correctly terminated, 
#> No new variables entered the model
#> 
#> Boot 5
#> 
#> Selection correctly terminated, 
#> No new variables entered the model
#> 
#> Boot 6
#> Entered at Step 1 is - Gender
#> 
#> 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 - Gender
#> 
#> Selection correctly terminated, 
#> No new variables entered the model
#> 
#> Boot 9
#> Entered at Step 1 is - Age
#> 
#> Selection correctly terminated, 
#> No new variables entered the model
#> 
#> Boot 10
#> 
#> Selection correctly terminated, 
#> No new variables entered the model
#> 
#> Boot 11
#> 
#> Selection correctly terminated, 
#> No new variables entered the model
#> 
#> Boot 12
#> Entered at Step 1 is - Gender
#> 
#> Selection correctly terminated, 
#> No new variables entered the model
#> 
#> Boot 13
#> 
#> Selection correctly terminated, 
#> No new variables entered the model
#> 
#> Boot 14
#> Entered at Step 1 is - Gender
#> 
#> Selection correctly terminated, 
#> No new variables entered the model
#> 
#> Boot 15
#> 
#> 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 - Age
#> 
#> Selection correctly terminated, 
#> No new variables entered the model
#> 
#> Boot 18
#> 
#> Selection correctly terminated, 
#> No new variables entered the model
#> 
#> Boot 19
#> 
#> Selection correctly terminated, 
#> No new variables entered the model
#> 
#> Boot 20
#> Entered at Step 1 is - SocialSupport
#> 
#> Selection correctly terminated, 
#> No new variables entered the model
  
   stab_res$bif
#>         Gender Smoking JobControl Age Duration JobDemands SocialSupport
#> boot 1       0       0          0   0        0          0             0
#> boot 2       0       0          0   1        0          0             0
#> boot 3       1       0          0   0        0          0             0
#> boot 4       1       0          0   0        0          0             0
#> boot 5       0       0          0   0        0          0             0
#> boot 6       1       0          0   0        0          0             0
#> boot 7       0       0          0   0        0          0             0
#> boot 8       1       0          0   0        0          0             0
#> boot 9       0       0          0   1        0          0             0
#> boot 10      0       0          0   0        0          0             0
#> boot 11      0       0          0   0        0          0             0
#> boot 12      1       0          0   0        0          0             0
#> boot 13      0       0          0   0        0          0             0
#> boot 14      1       0          0   0        0          0             0
#> boot 15      0       0          0   0        0          0             0
#> boot 16      0       0          0   0        0          0             0
#> boot 17      0       0          0   1        0          0             0
#> boot 18      0       0          0   0        0          0             0
#> boot 19      0       0          0   0        0          0             0
#> boot 20      0       0          0   0        0          0             1
#>         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
   
  stab_res$bif_perc
#>               Gender              Smoking           JobControl 
#>                   30                    0                    0 
#>                  Age             Duration           JobDemands 
#>                   15                    0                    0 
#>        SocialSupport factor(Satisfaction)    Gender*JobControl 
#>                    5                    0                    0
  
  stab_res$model_stab
#>   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
#> 4      0       0          0   0        0          0             1
#>   factor(Satisfaction) Gender*JobControl freq bif_pat_perc
#> 1                    0                 0   10           50
#> 2                    0                 0    6           30
#> 3                    0                 0    3           15
#> 4                    0                 0    1            5

Back to Examples

2.1.1 Stability analysis of Cox regression model


  library(psfmi)
  pool_lr <- psfmi_coxr(formula = Surv(Time, Status) ~ Pain + factor(Satisfaction) + rcs(Tampascale,3) +
                        Radiation + Radiation*factor(Satisfaction) + Age + Duration + Previous +
                        Radiation*rcs(Tampascale, 3), data=lbpmicox, p.crit = 0.157, direction="FW",
                        nimp=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
  pool_lr$RR_Model
#> NULL
  pool_lr$multiparm
#> $`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

  stab_res <- psfmi_stab(pool_lr, direction="FW", start_model = TRUE,
      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 - Duration
#> Entered at Step 2 is - Pain
#> 
#> Selection correctly terminated, 
#> No new variables entered the model
#> 
#> Boot 3
#> 
#> Selection correctly terminated, 
#> No new variables entered the model
#> 
#> Boot 4
#> Entered at Step 1 is - Pain
#> 
#> 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 - Duration
#> 
#> 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
#> 
#> Selection correctly terminated, 
#> No new variables entered the model
#> 
#> Boot 11
#> 
#> 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 - Pain
#> 
#> Selection correctly terminated, 
#> No new variables entered the model
#> 
#> Boot 16
#> 
#> Selection correctly terminated, 
#> No new variables entered the model
#> 
#> Boot 17
#> 
#> 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 - Age
#> Entered at Step 2 is - Pain
#> 
#> Selection correctly terminated, 
#> No new variables entered the model
  
  stab_res$bif
#>         Pain Radiation Age Duration Previous factor(Satisfaction)
#> boot 1     0         0   0        0        0                    0
#> boot 2     1         0   0        1        0                    0
#> boot 3     0         0   0        0        0                    0
#> boot 4     1         0   0        0        0                    0
#> boot 5     1         0   0        0        0                    0
#> boot 6     0         0   0        1        0                    0
#> boot 7     0         0   0        0        0                    0
#> boot 8     0         0   0        0        0                    0
#> boot 9     0         0   0        0        0                    0
#> boot 10    0         0   0        0        0                    0
#> boot 11    0         0   0        0        0                    0
#> boot 12    0         0   0        0        0                    0
#> boot 13    0         0   0        0        0                    0
#> boot 14    0         0   0        0        0                    0
#> boot 15    1         0   0        0        0                    0
#> boot 16    0         0   0        0        0                    0
#> boot 17    0         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   1        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                 0                              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
  
  stab_res$bif_perc
#>                           Pain                      Radiation 
#>                             30                              0 
#>                            Age                       Duration 
#>                              5                             10 
#>                       Previous           factor(Satisfaction) 
#>                              0                              0 
#>              rcs(Tampascale,3) factor(Satisfaction)*Radiation 
#>                              0                              0 
#>    rcs(Tampascale,3)*Radiation 
#>                              0
  
  stab_res$model_stab
#>   Pain Radiation Age Duration Previous factor(Satisfaction) rcs(Tampascale,3)
#> 1    0         0   0        0        0                    0                 0
#> 2    1         0   0        0        0                    0                 0
#> 3    0         0   0        1        0                    0                 0
#> 4    1         0   0        1        0                    0                 0
#> 5    1         0   1        0        0                    0                 0
#>   factor(Satisfaction)*Radiation rcs(Tampascale,3)*Radiation freq bif_pat_perc
#> 1                              0                           0   13           65
#> 2                              0                           0    4           20
#> 3                              0                           0    1            5
#> 4                              0                           0    1            5
#> 5                              0                           0    1            5

Back to Examples