tests/testthat/_snaps/stepaic-b-output.md

output from stepAIC backward regression is as expected

Code
  ols_step_backward_aic(model)
Output


                               Stepwise Summary                              
  -------------------------------------------------------------------------
  Step    Variable        AIC        SBC       SBIC        R2       Adj. R2 
  -------------------------------------------------------------------------
   0      Full Model    736.390    756.280    586.665    0.78184    0.74305 
   1      alc_mod       734.407    752.308    583.884    0.78177    0.74856 
   2      gender        732.494    748.406    581.290    0.78142    0.75351 
   3      age           730.620    744.543    578.844    0.78091    0.75808 
  -------------------------------------------------------------------------

  Final Model Output 
  ------------------

                             Model Summary                            
  -------------------------------------------------------------------
  R                         0.884       RMSE                 184.276 
  R-Squared                 0.781       MSE                38202.426 
  Adj. R-Squared            0.758       Coef. Var             27.839 
  Pred R-Squared            0.700       AIC                  730.620 
  MAE                     137.656       SBC                  744.543 
  -------------------------------------------------------------------
   RMSE: Root Mean Square Error 
   MSE: Mean Square Error 
   MAE: Mean Absolute Error 
   AIC: Akaike Information Criteria 
   SBC: Schwarz Bayesian Criteria

                                   ANOVA                                  
  -----------------------------------------------------------------------
                     Sum of                                              
                    Squares        DF    Mean Square      F         Sig. 
  -----------------------------------------------------------------------
  Regression    6535804.090         5    1307160.818    34.217    0.0000 
  Residual      1833716.447        48      38202.426                     
  Total         8369520.537        53                                    
  -----------------------------------------------------------------------

                                        Parameter Estimates                                        
  ------------------------------------------------------------------------------------------------
        model         Beta    Std. Error    Std. Beta      t        Sig         lower       upper 
  ------------------------------------------------------------------------------------------------
  (Intercept)    -1178.330       208.682                 -5.647    0.000    -1597.914    -758.746 
          bcs       59.864        23.060        0.241     2.596    0.012       13.498     106.230 
       pindex        8.924         1.808        0.380     4.935    0.000        5.288      12.559 
  enzyme_test        9.748         1.656        0.521     5.887    0.000        6.419      13.077 
   liver_test       58.064        40.144        0.156     1.446    0.155      -22.652     138.779 
    alc_heavy      317.848        71.634        0.314     4.437    0.000      173.818     461.878 
  ------------------------------------------------------------------------------------------------
Code
  ols_step_backward_aic(model, progress = TRUE)
Output
  Backward Elimination Method 
  ---------------------------

  Candidate Terms:

  1. bcs 
  2. pindex 
  3. enzyme_test 
  4. liver_test 
  5. age 
  6. gender 
  7. alc_mod 
  8. alc_heavy


  Variables Removed:

  => alc_mod 
  => gender 
  => age

  No more variables to be removed.


                               Stepwise Summary                              
  -------------------------------------------------------------------------
  Step    Variable        AIC        SBC       SBIC        R2       Adj. R2 
  -------------------------------------------------------------------------
   0      Full Model    736.390    756.280    586.665    0.78184    0.74305 
   1      alc_mod       734.407    752.308    583.884    0.78177    0.74856 
   2      gender        732.494    748.406    581.290    0.78142    0.75351 
   3      age           730.620    744.543    578.844    0.78091    0.75808 
  -------------------------------------------------------------------------

  Final Model Output 
  ------------------

                             Model Summary                            
  -------------------------------------------------------------------
  R                         0.884       RMSE                 184.276 
  R-Squared                 0.781       MSE                38202.426 
  Adj. R-Squared            0.758       Coef. Var             27.839 
  Pred R-Squared            0.700       AIC                  730.620 
  MAE                     137.656       SBC                  744.543 
  -------------------------------------------------------------------
   RMSE: Root Mean Square Error 
   MSE: Mean Square Error 
   MAE: Mean Absolute Error 
   AIC: Akaike Information Criteria 
   SBC: Schwarz Bayesian Criteria

                                   ANOVA                                  
  -----------------------------------------------------------------------
                     Sum of                                              
                    Squares        DF    Mean Square      F         Sig. 
  -----------------------------------------------------------------------
  Regression    6535804.090         5    1307160.818    34.217    0.0000 
  Residual      1833716.447        48      38202.426                     
  Total         8369520.537        53                                    
  -----------------------------------------------------------------------

                                        Parameter Estimates                                        
  ------------------------------------------------------------------------------------------------
        model         Beta    Std. Error    Std. Beta      t        Sig         lower       upper 
  ------------------------------------------------------------------------------------------------
  (Intercept)    -1178.330       208.682                 -5.647    0.000    -1597.914    -758.746 
          bcs       59.864        23.060        0.241     2.596    0.012       13.498     106.230 
       pindex        8.924         1.808        0.380     4.935    0.000        5.288      12.559 
  enzyme_test        9.748         1.656        0.521     5.887    0.000        6.419      13.077 
   liver_test       58.064        40.144        0.156     1.446    0.155      -22.652     138.779 
    alc_heavy      317.848        71.634        0.314     4.437    0.000      173.818     461.878 
  ------------------------------------------------------------------------------------------------
Code
  ols_step_backward_aic(model, details = TRUE)
Output
  Backward Elimination Method 
  ---------------------------

  Candidate Terms:

  1. bcs 
  2. pindex 
  3. enzyme_test 
  4. liver_test 
  5. age 
  6. gender 
  7. alc_mod 
  8. alc_heavy


  Step     => 0 
  Model    => y ~ bcs + pindex + enzyme_test + liver_test + age + gender + alc_mod + alc_heavy 
  AIC      => 736.3899

  Initiating stepwise selection...

                     Table: Removing Existing Variables                    
  ------------------------------------------------------------------------
  Predictor      DF      AIC        SBC       SBIC        R2       Adj. R2 
  ------------------------------------------------------------------------
  alc_mod         1    734.407    752.308    584.276    0.78177    0.74856 
  gender          1    734.478    752.379    584.323    0.78148    0.74823 
  age             1    734.544    752.445    584.367    0.78121    0.74792 
  liver_test      1    735.878    753.779    585.255    0.77574    0.74162 
  bcs             1    741.677    759.577    589.203    0.75032    0.71233 
  alc_heavy       1    749.210    767.111    594.541    0.71294    0.66926 
  pindex          1    756.624    774.525    600.014    0.67070    0.62059 
  enzyme_test     1    763.557    781.458    605.318    0.62559    0.56861 
  ------------------------------------------------------------------------

  Step     => 1 
  Removed  => alc_mod 
  Model    => y ~ bcs + pindex + enzyme_test + liver_test + age + gender + alc_heavy 
  AIC      => 734.4068

                     Table: Removing Existing Variables                    
  ------------------------------------------------------------------------
  Predictor      DF      AIC        SBC       SBIC        R2       Adj. R2 
  ------------------------------------------------------------------------
  gender          1    732.494    748.406    581.938    0.78142    0.75351 
  age             1    732.551    748.463    581.978    0.78119    0.75325 
  liver_test      1    733.921    749.833    582.951    0.77556    0.74691 
  bcs             1    739.677    755.589    587.106    0.75032    0.71845 
  alc_heavy       1    750.486    766.398    595.217    0.69499    0.65605 
  pindex          1    754.759    770.671    598.530    0.66987    0.62773 
  enzyme_test     1    761.595    777.507    603.950    0.62532    0.57749 
  ------------------------------------------------------------------------

  Step     => 2 
  Removed  => gender 
  Model    => y ~ bcs + pindex + enzyme_test + liver_test + age + alc_heavy 
  AIC      => 732.4942

                     Table: Removing Existing Variables                    
  ------------------------------------------------------------------------
  Predictor      DF      AIC        SBC       SBIC        R2       Adj. R2 
  ------------------------------------------------------------------------
  age             1    730.620    744.543    579.638    0.78091    0.75808 
  liver_test      1    732.339    746.262    580.934    0.77382    0.75026 
  bcs             1    737.680    751.603    585.012    0.75030    0.72429 
  alc_heavy       1    748.486    762.409    593.500    0.69499    0.66322 
  pindex          1    752.777    766.700    596.959    0.66976    0.63536 
  enzyme_test     1    759.596    773.518    602.553    0.62532    0.58629 
  ------------------------------------------------------------------------

  Step     => 3 
  Removed  => age 
  Model    => y ~ bcs + pindex + enzyme_test + liver_test + alc_heavy 
  AIC      => 730.6204

                     Table: Removing Existing Variables                    
  ------------------------------------------------------------------------
  Predictor      DF      AIC        SBC       SBIC        R2       Adj. R2 
  ------------------------------------------------------------------------
  liver_test      1    730.924    742.858    579.087    0.77136    0.75269 
  bcs             1    735.715    747.649    582.943    0.75015    0.72975 
  alc_heavy       1    747.181    759.114    592.362    0.69104    0.66582 
  pindex          1    750.782    762.716    595.377    0.66973    0.64277 
  enzyme_test     1    757.971    769.905    601.477    0.62270    0.59190 
  ------------------------------------------------------------------------


  No more variables to be removed.

  Variables Removed:

  => alc_mod 
  => gender 
  => age


                               Stepwise Summary                              
  -------------------------------------------------------------------------
  Step    Variable        AIC        SBC       SBIC        R2       Adj. R2 
  -------------------------------------------------------------------------
   0      Full Model    736.390    756.280    586.665    0.78184    0.74305 
   1      alc_mod       734.407    752.308    583.884    0.78177    0.74856 
   2      gender        732.494    748.406    581.290    0.78142    0.75351 
   3      age           730.620    744.543    578.844    0.78091    0.75808 
  -------------------------------------------------------------------------

  Final Model Output 
  ------------------

                             Model Summary                            
  -------------------------------------------------------------------
  R                         0.884       RMSE                 184.276 
  R-Squared                 0.781       MSE                38202.426 
  Adj. R-Squared            0.758       Coef. Var             27.839 
  Pred R-Squared            0.700       AIC                  730.620 
  MAE                     137.656       SBC                  744.543 
  -------------------------------------------------------------------
   RMSE: Root Mean Square Error 
   MSE: Mean Square Error 
   MAE: Mean Absolute Error 
   AIC: Akaike Information Criteria 
   SBC: Schwarz Bayesian Criteria

                                   ANOVA                                  
  -----------------------------------------------------------------------
                     Sum of                                              
                    Squares        DF    Mean Square      F         Sig. 
  -----------------------------------------------------------------------
  Regression    6535804.090         5    1307160.818    34.217    0.0000 
  Residual      1833716.447        48      38202.426                     
  Total         8369520.537        53                                    
  -----------------------------------------------------------------------

                                        Parameter Estimates                                        
  ------------------------------------------------------------------------------------------------
        model         Beta    Std. Error    Std. Beta      t        Sig         lower       upper 
  ------------------------------------------------------------------------------------------------
  (Intercept)    -1178.330       208.682                 -5.647    0.000    -1597.914    -758.746 
          bcs       59.864        23.060        0.241     2.596    0.012       13.498     106.230 
       pindex        8.924         1.808        0.380     4.935    0.000        5.288      12.559 
  enzyme_test        9.748         1.656        0.521     5.887    0.000        6.419      13.077 
   liver_test       58.064        40.144        0.156     1.446    0.155      -22.652     138.779 
    alc_heavy      317.848        71.634        0.314     4.437    0.000      173.818     461.878 
  ------------------------------------------------------------------------------------------------

output from stepSBC backward regression is as expected

Code
  ols_step_backward_sbc(model)
Output


                               Stepwise Summary                              
  -------------------------------------------------------------------------
  Step    Variable        AIC        SBC       SBIC        R2       Adj. R2 
  -------------------------------------------------------------------------
   0      Full Model    736.390    756.280    586.665    0.78184    0.74305 
   1      alc_mod       734.407    752.308    583.884    0.78177    0.74856 
   2      gender        732.494    748.406    581.290    0.78142    0.75351 
   3      age           730.620    744.543    578.844    0.78091    0.75808 
   4      liver_test    730.924    742.858    578.678    0.77136    0.75269 
  -------------------------------------------------------------------------

  Final Model Output 
  ------------------

                             Model Summary                            
  -------------------------------------------------------------------
  R                         0.878       RMSE                 188.249 
  R-Squared                 0.771       MSE                39053.801 
  Adj. R-Squared            0.753       Coef. Var             28.147 
  Pred R-Squared            0.695       AIC                  730.924 
  MAE                     140.619       SBC                  742.858 
  -------------------------------------------------------------------
   RMSE: Root Mean Square Error 
   MSE: Mean Square Error 
   MAE: Mean Absolute Error 
   AIC: Akaike Information Criteria 
   SBC: Schwarz Bayesian Criteria

                                   ANOVA                                  
  -----------------------------------------------------------------------
                     Sum of                                              
                    Squares        DF    Mean Square      F         Sig. 
  -----------------------------------------------------------------------
  Regression    6455884.265         4    1613971.066    41.327    0.0000 
  Residual      1913636.272        49      39053.801                     
  Total         8369520.537        53                                    
  -----------------------------------------------------------------------

                                        Parameter Estimates                                        
  ------------------------------------------------------------------------------------------------
        model         Beta    Std. Error    Std. Beta      t        Sig         lower       upper 
  ------------------------------------------------------------------------------------------------
  (Intercept)    -1334.424       180.589                 -7.389    0.000    -1697.332    -971.516 
          bcs       81.439        17.781        0.329     4.580    0.000       45.706     117.171 
       pindex       10.131         1.622        0.431     6.246    0.000        6.871      13.390 
  enzyme_test       11.243         1.308        0.601     8.596    0.000        8.614      13.871 
    alc_heavy      312.777        72.341        0.309     4.324    0.000      167.402     458.152 
  ------------------------------------------------------------------------------------------------
Code
  ols_step_backward_sbc(model, progress = TRUE)
Output
  Backward Elimination Method 
  ---------------------------

  Candidate Terms:

  1. bcs 
  2. pindex 
  3. enzyme_test 
  4. liver_test 
  5. age 
  6. gender 
  7. alc_mod 
  8. alc_heavy


  Variables Removed:

  => alc_mod 
  => gender 
  => age 
  => liver_test

  No more variables to be removed.


                               Stepwise Summary                              
  -------------------------------------------------------------------------
  Step    Variable        AIC        SBC       SBIC        R2       Adj. R2 
  -------------------------------------------------------------------------
   0      Full Model    736.390    756.280    586.665    0.78184    0.74305 
   1      alc_mod       734.407    752.308    583.884    0.78177    0.74856 
   2      gender        732.494    748.406    581.290    0.78142    0.75351 
   3      age           730.620    744.543    578.844    0.78091    0.75808 
   4      liver_test    730.924    742.858    578.678    0.77136    0.75269 
  -------------------------------------------------------------------------

  Final Model Output 
  ------------------

                             Model Summary                            
  -------------------------------------------------------------------
  R                         0.878       RMSE                 188.249 
  R-Squared                 0.771       MSE                39053.801 
  Adj. R-Squared            0.753       Coef. Var             28.147 
  Pred R-Squared            0.695       AIC                  730.924 
  MAE                     140.619       SBC                  742.858 
  -------------------------------------------------------------------
   RMSE: Root Mean Square Error 
   MSE: Mean Square Error 
   MAE: Mean Absolute Error 
   AIC: Akaike Information Criteria 
   SBC: Schwarz Bayesian Criteria

                                   ANOVA                                  
  -----------------------------------------------------------------------
                     Sum of                                              
                    Squares        DF    Mean Square      F         Sig. 
  -----------------------------------------------------------------------
  Regression    6455884.265         4    1613971.066    41.327    0.0000 
  Residual      1913636.272        49      39053.801                     
  Total         8369520.537        53                                    
  -----------------------------------------------------------------------

                                        Parameter Estimates                                        
  ------------------------------------------------------------------------------------------------
        model         Beta    Std. Error    Std. Beta      t        Sig         lower       upper 
  ------------------------------------------------------------------------------------------------
  (Intercept)    -1334.424       180.589                 -7.389    0.000    -1697.332    -971.516 
          bcs       81.439        17.781        0.329     4.580    0.000       45.706     117.171 
       pindex       10.131         1.622        0.431     6.246    0.000        6.871      13.390 
  enzyme_test       11.243         1.308        0.601     8.596    0.000        8.614      13.871 
    alc_heavy      312.777        72.341        0.309     4.324    0.000      167.402     458.152 
  ------------------------------------------------------------------------------------------------
Code
  ols_step_backward_sbc(model, details = TRUE)
Output
  Backward Elimination Method 
  ---------------------------

  Candidate Terms:

  1. bcs 
  2. pindex 
  3. enzyme_test 
  4. liver_test 
  5. age 
  6. gender 
  7. alc_mod 
  8. alc_heavy


  Step     => 0 
  Model    => y ~ bcs + pindex + enzyme_test + liver_test + age + gender + alc_mod + alc_heavy 
  SBC      => 756.2797

  Initiating stepwise selection...

                     Table: Removing Existing Variables                    
  ------------------------------------------------------------------------
  Predictor      DF      AIC        SBC       SBIC        R2       Adj. R2 
  ------------------------------------------------------------------------
  alc_mod         1    734.407    752.308    584.276    0.78177    0.74856 
  gender          1    734.478    752.379    584.323    0.78148    0.74823 
  age             1    734.544    752.445    584.367    0.78121    0.74792 
  liver_test      1    735.878    753.779    585.255    0.77574    0.74162 
  bcs             1    741.677    759.577    589.203    0.75032    0.71233 
  alc_heavy       1    749.210    767.111    594.541    0.71294    0.66926 
  pindex          1    756.624    774.525    600.014    0.67070    0.62059 
  enzyme_test     1    763.557    781.458    605.318    0.62559    0.56861 
  ------------------------------------------------------------------------

  Step     => 1 
  Removed  => alc_mod 
  Model    => y ~ bcs + pindex + enzyme_test + liver_test + age + gender + alc_heavy 
  SBC      => 752.3077

                     Table: Removing Existing Variables                    
  ------------------------------------------------------------------------
  Predictor      DF      AIC        SBC       SBIC        R2       Adj. R2 
  ------------------------------------------------------------------------
  gender          1    732.494    748.406    581.938    0.78142    0.75351 
  age             1    732.551    748.463    581.978    0.78119    0.75325 
  liver_test      1    733.921    749.833    582.951    0.77556    0.74691 
  bcs             1    739.677    755.589    587.106    0.75032    0.71845 
  alc_heavy       1    750.486    766.398    595.217    0.69499    0.65605 
  pindex          1    754.759    770.671    598.530    0.66987    0.62773 
  enzyme_test     1    761.595    777.507    603.950    0.62532    0.57749 
  ------------------------------------------------------------------------

  Step     => 2 
  Removed  => gender 
  Model    => y ~ bcs + pindex + enzyme_test + liver_test + age + alc_heavy 
  SBC      => 748.4061

                     Table: Removing Existing Variables                    
  ------------------------------------------------------------------------
  Predictor      DF      AIC        SBC       SBIC        R2       Adj. R2 
  ------------------------------------------------------------------------
  age             1    730.620    744.543    579.638    0.78091    0.75808 
  liver_test      1    732.339    746.262    580.934    0.77382    0.75026 
  bcs             1    737.680    751.603    585.012    0.75030    0.72429 
  alc_heavy       1    748.486    762.409    593.500    0.69499    0.66322 
  pindex          1    752.777    766.700    596.959    0.66976    0.63536 
  enzyme_test     1    759.596    773.518    602.553    0.62532    0.58629 
  ------------------------------------------------------------------------

  Step     => 3 
  Removed  => age 
  Model    => y ~ bcs + pindex + enzyme_test + liver_test + alc_heavy 
  SBC      => 744.5433

                     Table: Removing Existing Variables                    
  ------------------------------------------------------------------------
  Predictor      DF      AIC        SBC       SBIC        R2       Adj. R2 
  ------------------------------------------------------------------------
  liver_test      1    730.924    742.858    579.087    0.77136    0.75269 
  bcs             1    735.715    747.649    582.943    0.75015    0.72975 
  alc_heavy       1    747.181    759.114    592.362    0.69104    0.66582 
  pindex          1    750.782    762.716    595.377    0.66973    0.64277 
  enzyme_test     1    757.971    769.905    601.477    0.62270    0.59190 
  ------------------------------------------------------------------------

  Step     => 4 
  Removed  => liver_test 
  Model    => y ~ bcs + pindex + enzyme_test + alc_heavy 
  SBC      => 742.858

                     Table: Removing Existing Variables                    
  ------------------------------------------------------------------------
  Predictor      DF      AIC        SBC       SBIC        R2       Adj. R2 
  ------------------------------------------------------------------------
  alc_heavy       1    746.376    756.320    591.702    0.68413    0.66518 
  bcs             1    748.167    758.112    593.257    0.67347    0.65388 
  pindex          1    760.551    770.496    604.143    0.58930    0.56466 
  enzyme_test     1    778.574    788.519    620.390    0.42659    0.39218 
  ------------------------------------------------------------------------


  No more variables to be removed.

  Variables Removed:

  => alc_mod 
  => gender 
  => age 
  => liver_test


                               Stepwise Summary                              
  -------------------------------------------------------------------------
  Step    Variable        AIC        SBC       SBIC        R2       Adj. R2 
  -------------------------------------------------------------------------
   0      Full Model    736.390    756.280    586.665    0.78184    0.74305 
   1      alc_mod       734.407    752.308    583.884    0.78177    0.74856 
   2      gender        732.494    748.406    581.290    0.78142    0.75351 
   3      age           730.620    744.543    578.844    0.78091    0.75808 
   4      liver_test    730.924    742.858    578.678    0.77136    0.75269 
  -------------------------------------------------------------------------

  Final Model Output 
  ------------------

                             Model Summary                            
  -------------------------------------------------------------------
  R                         0.878       RMSE                 188.249 
  R-Squared                 0.771       MSE                39053.801 
  Adj. R-Squared            0.753       Coef. Var             28.147 
  Pred R-Squared            0.695       AIC                  730.924 
  MAE                     140.619       SBC                  742.858 
  -------------------------------------------------------------------
   RMSE: Root Mean Square Error 
   MSE: Mean Square Error 
   MAE: Mean Absolute Error 
   AIC: Akaike Information Criteria 
   SBC: Schwarz Bayesian Criteria

                                   ANOVA                                  
  -----------------------------------------------------------------------
                     Sum of                                              
                    Squares        DF    Mean Square      F         Sig. 
  -----------------------------------------------------------------------
  Regression    6455884.265         4    1613971.066    41.327    0.0000 
  Residual      1913636.272        49      39053.801                     
  Total         8369520.537        53                                    
  -----------------------------------------------------------------------

                                        Parameter Estimates                                        
  ------------------------------------------------------------------------------------------------
        model         Beta    Std. Error    Std. Beta      t        Sig         lower       upper 
  ------------------------------------------------------------------------------------------------
  (Intercept)    -1334.424       180.589                 -7.389    0.000    -1697.332    -971.516 
          bcs       81.439        17.781        0.329     4.580    0.000       45.706     117.171 
       pindex       10.131         1.622        0.431     6.246    0.000        6.871      13.390 
  enzyme_test       11.243         1.308        0.601     8.596    0.000        8.614      13.871 
    alc_heavy      312.777        72.341        0.309     4.324    0.000      167.402     458.152 
  ------------------------------------------------------------------------------------------------

output from stepSBIC backward regression is as expected

Code
  ols_step_backward_sbic(model)
Output


                               Stepwise Summary                              
  -------------------------------------------------------------------------
  Step    Variable        AIC        SBC       SBIC        R2       Adj. R2 
  -------------------------------------------------------------------------
   0      Full Model    736.390    756.280    586.665    0.78184    0.74305 
   1      alc_mod       734.407    752.308    583.884    0.78177    0.74856 
   2      gender        732.494    748.406    581.290    0.78142    0.75351 
   3      age           730.620    744.543    578.844    0.78091    0.75808 
   4      liver_test    730.924    742.858    578.678    0.77136    0.75269 
  -------------------------------------------------------------------------

  Final Model Output 
  ------------------

                             Model Summary                            
  -------------------------------------------------------------------
  R                         0.878       RMSE                 188.249 
  R-Squared                 0.771       MSE                39053.801 
  Adj. R-Squared            0.753       Coef. Var             28.147 
  Pred R-Squared            0.695       AIC                  730.924 
  MAE                     140.619       SBC                  742.858 
  -------------------------------------------------------------------
   RMSE: Root Mean Square Error 
   MSE: Mean Square Error 
   MAE: Mean Absolute Error 
   AIC: Akaike Information Criteria 
   SBC: Schwarz Bayesian Criteria

                                   ANOVA                                  
  -----------------------------------------------------------------------
                     Sum of                                              
                    Squares        DF    Mean Square      F         Sig. 
  -----------------------------------------------------------------------
  Regression    6455884.265         4    1613971.066    41.327    0.0000 
  Residual      1913636.272        49      39053.801                     
  Total         8369520.537        53                                    
  -----------------------------------------------------------------------

                                        Parameter Estimates                                        
  ------------------------------------------------------------------------------------------------
        model         Beta    Std. Error    Std. Beta      t        Sig         lower       upper 
  ------------------------------------------------------------------------------------------------
  (Intercept)    -1334.424       180.589                 -7.389    0.000    -1697.332    -971.516 
          bcs       81.439        17.781        0.329     4.580    0.000       45.706     117.171 
       pindex       10.131         1.622        0.431     6.246    0.000        6.871      13.390 
  enzyme_test       11.243         1.308        0.601     8.596    0.000        8.614      13.871 
    alc_heavy      312.777        72.341        0.309     4.324    0.000      167.402     458.152 
  ------------------------------------------------------------------------------------------------
Code
  ols_step_backward_sbic(model, progress = TRUE)
Output
  Backward Elimination Method 
  ---------------------------

  Candidate Terms:

  1. bcs 
  2. pindex 
  3. enzyme_test 
  4. liver_test 
  5. age 
  6. gender 
  7. alc_mod 
  8. alc_heavy


  Variables Removed:

  => alc_mod 
  => gender 
  => age 
  => liver_test

  No more variables to be removed.


                               Stepwise Summary                              
  -------------------------------------------------------------------------
  Step    Variable        AIC        SBC       SBIC        R2       Adj. R2 
  -------------------------------------------------------------------------
   0      Full Model    736.390    756.280    586.665    0.78184    0.74305 
   1      alc_mod       734.407    752.308    583.884    0.78177    0.74856 
   2      gender        732.494    748.406    581.290    0.78142    0.75351 
   3      age           730.620    744.543    578.844    0.78091    0.75808 
   4      liver_test    730.924    742.858    578.678    0.77136    0.75269 
  -------------------------------------------------------------------------

  Final Model Output 
  ------------------

                             Model Summary                            
  -------------------------------------------------------------------
  R                         0.878       RMSE                 188.249 
  R-Squared                 0.771       MSE                39053.801 
  Adj. R-Squared            0.753       Coef. Var             28.147 
  Pred R-Squared            0.695       AIC                  730.924 
  MAE                     140.619       SBC                  742.858 
  -------------------------------------------------------------------
   RMSE: Root Mean Square Error 
   MSE: Mean Square Error 
   MAE: Mean Absolute Error 
   AIC: Akaike Information Criteria 
   SBC: Schwarz Bayesian Criteria

                                   ANOVA                                  
  -----------------------------------------------------------------------
                     Sum of                                              
                    Squares        DF    Mean Square      F         Sig. 
  -----------------------------------------------------------------------
  Regression    6455884.265         4    1613971.066    41.327    0.0000 
  Residual      1913636.272        49      39053.801                     
  Total         8369520.537        53                                    
  -----------------------------------------------------------------------

                                        Parameter Estimates                                        
  ------------------------------------------------------------------------------------------------
        model         Beta    Std. Error    Std. Beta      t        Sig         lower       upper 
  ------------------------------------------------------------------------------------------------
  (Intercept)    -1334.424       180.589                 -7.389    0.000    -1697.332    -971.516 
          bcs       81.439        17.781        0.329     4.580    0.000       45.706     117.171 
       pindex       10.131         1.622        0.431     6.246    0.000        6.871      13.390 
  enzyme_test       11.243         1.308        0.601     8.596    0.000        8.614      13.871 
    alc_heavy      312.777        72.341        0.309     4.324    0.000      167.402     458.152 
  ------------------------------------------------------------------------------------------------
Code
  ols_step_backward_sbic(model, details = TRUE)
Output
  Backward Elimination Method 
  ---------------------------

  Candidate Terms:

  1. bcs 
  2. pindex 
  3. enzyme_test 
  4. liver_test 
  5. age 
  6. gender 
  7. alc_mod 
  8. alc_heavy


  Step     => 0 
  Model    => y ~ bcs + pindex + enzyme_test + liver_test + age + gender + alc_mod + alc_heavy 
  SBIC     => 586.6645

  Initiating stepwise selection...

                     Table: Removing Existing Variables                    
  ------------------------------------------------------------------------
  Predictor      DF      AIC        SBC       SBIC        R2       Adj. R2 
  ------------------------------------------------------------------------
  alc_mod         1    734.407    752.308    584.276    0.78177    0.74856 
  gender          1    734.478    752.379    584.323    0.78148    0.74823 
  age             1    734.544    752.445    584.367    0.78121    0.74792 
  liver_test      1    735.878    753.779    585.255    0.77574    0.74162 
  bcs             1    741.677    759.577    589.203    0.75032    0.71233 
  alc_heavy       1    749.210    767.111    594.541    0.71294    0.66926 
  pindex          1    756.624    774.525    600.014    0.67070    0.62059 
  enzyme_test     1    763.557    781.458    605.318    0.62559    0.56861 
  ------------------------------------------------------------------------

  Step     => 1 
  Removed  => alc_mod 
  Model    => y ~ bcs + pindex + enzyme_test + liver_test + age + gender + alc_heavy 
  SBIC     => 584.2758

                     Table: Removing Existing Variables                    
  ------------------------------------------------------------------------
  Predictor      DF      AIC        SBC       SBIC        R2       Adj. R2 
  ------------------------------------------------------------------------
  gender          1    732.494    748.406    581.938    0.78142    0.75351 
  age             1    732.551    748.463    581.978    0.78119    0.75325 
  liver_test      1    733.921    749.833    582.951    0.77556    0.74691 
  bcs             1    739.677    755.589    587.106    0.75032    0.71845 
  alc_heavy       1    750.486    766.398    595.217    0.69499    0.65605 
  pindex          1    754.759    770.671    598.530    0.66987    0.62773 
  enzyme_test     1    761.595    777.507    603.950    0.62532    0.57749 
  ------------------------------------------------------------------------

  Step     => 2 
  Removed  => gender 
  Model    => y ~ bcs + pindex + enzyme_test + liver_test + age + alc_heavy 
  SBIC     => 581.9383

                     Table: Removing Existing Variables                    
  ------------------------------------------------------------------------
  Predictor      DF      AIC        SBC       SBIC        R2       Adj. R2 
  ------------------------------------------------------------------------
  age             1    730.620    744.543    579.638    0.78091    0.75808 
  liver_test      1    732.339    746.262    580.934    0.77382    0.75026 
  bcs             1    737.680    751.603    585.012    0.75030    0.72429 
  alc_heavy       1    748.486    762.409    593.500    0.69499    0.66322 
  pindex          1    752.777    766.700    596.959    0.66976    0.63536 
  enzyme_test     1    759.596    773.518    602.553    0.62532    0.58629 
  ------------------------------------------------------------------------

  Step     => 3 
  Removed  => age 
  Model    => y ~ bcs + pindex + enzyme_test + liver_test + alc_heavy 
  SBIC     => 579.6377

                     Table: Removing Existing Variables                    
  ------------------------------------------------------------------------
  Predictor      DF      AIC        SBC       SBIC        R2       Adj. R2 
  ------------------------------------------------------------------------
  liver_test      1    730.924    742.858    579.087    0.77136    0.75269 
  bcs             1    735.715    747.649    582.943    0.75015    0.72975 
  alc_heavy       1    747.181    759.114    592.362    0.69104    0.66582 
  pindex          1    750.782    762.716    595.377    0.66973    0.64277 
  enzyme_test     1    757.971    769.905    601.477    0.62270    0.59190 
  ------------------------------------------------------------------------

  Step     => 4 
  Removed  => liver_test 
  Model    => y ~ bcs + pindex + enzyme_test + alc_heavy 
  SBIC     => 579.0865

                     Table: Removing Existing Variables                    
  ------------------------------------------------------------------------
  Predictor      DF      AIC        SBC       SBIC        R2       Adj. R2 
  ------------------------------------------------------------------------
  alc_heavy       1    746.376    756.320    591.702    0.68413    0.66518 
  bcs             1    748.167    758.112    593.257    0.67347    0.65388 
  pindex          1    760.551    770.496    604.143    0.58930    0.56466 
  enzyme_test     1    778.574    788.519    620.390    0.42659    0.39218 
  ------------------------------------------------------------------------


  No more variables to be removed.

  Variables Removed:

  => alc_mod 
  => gender 
  => age 
  => liver_test


                               Stepwise Summary                              
  -------------------------------------------------------------------------
  Step    Variable        AIC        SBC       SBIC        R2       Adj. R2 
  -------------------------------------------------------------------------
   0      Full Model    736.390    756.280    586.665    0.78184    0.74305 
   1      alc_mod       734.407    752.308    583.884    0.78177    0.74856 
   2      gender        732.494    748.406    581.290    0.78142    0.75351 
   3      age           730.620    744.543    578.844    0.78091    0.75808 
   4      liver_test    730.924    742.858    578.678    0.77136    0.75269 
  -------------------------------------------------------------------------

  Final Model Output 
  ------------------

                             Model Summary                            
  -------------------------------------------------------------------
  R                         0.878       RMSE                 188.249 
  R-Squared                 0.771       MSE                39053.801 
  Adj. R-Squared            0.753       Coef. Var             28.147 
  Pred R-Squared            0.695       AIC                  730.924 
  MAE                     140.619       SBC                  742.858 
  -------------------------------------------------------------------
   RMSE: Root Mean Square Error 
   MSE: Mean Square Error 
   MAE: Mean Absolute Error 
   AIC: Akaike Information Criteria 
   SBC: Schwarz Bayesian Criteria

                                   ANOVA                                  
  -----------------------------------------------------------------------
                     Sum of                                              
                    Squares        DF    Mean Square      F         Sig. 
  -----------------------------------------------------------------------
  Regression    6455884.265         4    1613971.066    41.327    0.0000 
  Residual      1913636.272        49      39053.801                     
  Total         8369520.537        53                                    
  -----------------------------------------------------------------------

                                        Parameter Estimates                                        
  ------------------------------------------------------------------------------------------------
        model         Beta    Std. Error    Std. Beta      t        Sig         lower       upper 
  ------------------------------------------------------------------------------------------------
  (Intercept)    -1334.424       180.589                 -7.389    0.000    -1697.332    -971.516 
          bcs       81.439        17.781        0.329     4.580    0.000       45.706     117.171 
       pindex       10.131         1.622        0.431     6.246    0.000        6.871      13.390 
  enzyme_test       11.243         1.308        0.601     8.596    0.000        8.614      13.871 
    alc_heavy      312.777        72.341        0.309     4.324    0.000      167.402     458.152 
  ------------------------------------------------------------------------------------------------


Try the olsrr package in your browser

Any scripts or data that you put into this service are public.

olsrr documentation built on May 29, 2024, 12:35 p.m.