Skip to contents

This function calculates reduction of the surrogate R-squared goodness-of-fit of each variable to measure their relative explanatory power. This function creates a table containing the reductions of surrogate R-squared by removing each one of variables in the model.

Usage

surr_rsq_rank(object, avg.num = 30, var.set = NA, ...)

Arguments

object

A object of class "surr_rsq" that is generated by the function "surr_rsq". It contains the following components: surr_rsq, reduced_model, full_model, and data.

avg.num

The number of replication for the averaging of surrogate R-square.

var.set

A list that contains a few sets. Each component of these sets represents the variables that you want to examine for the contribution of goodness of fit. Then, for one component of this list, a model will fit by removing the specified variables.

...

Additional optional arguments.

Value

The default return is a list that contains the contribution of Surrogate R-squared for each variable in the full_model. If the var.set is specified, the return is a list of the contribution of the groups of variables in the var.set.

Examples

data("WhiteWine")

sele_formula <- as.formula(quality ~ fixed.acidity + volatile.acidity +
                          residual.sugar +  + free.sulfur.dioxide +
                          pH + sulphates + alcohol)

sele_mod <- polr(formula = sele_formula,
              data = WhiteWine,
              method = "probit")

sur1 <- surr_rsq(model = sele_mod,
              full_model = sele_mod,
              avg.num = 100)
# \donttest{
rank_tab_sur1 <- surr_rsq_rank(object  = sur1,
                               avg.num = 30)
print(rank_tab_sur1)
#>     Removed Variable SurrogateRsq Reduction Contribution Ranking
#>              alcohol      0.07042   0.23733       77.12%       1
#>     volatile.acidity      0.24411   0.06364       20.68%       2
#>       residual.sugar      0.28971   0.01804        5.86%       3
#>  free.sulfur.dioxide      0.30312   0.00463        1.50%       4
#>            sulphates      0.30422   0.00354        1.15%       5
#>        fixed.acidity      0.30479   0.00296        0.96%       6
#>                   pH      0.30717   0.00058        0.19%       7
#> ------------------------------------------------------------------------ 
#> The total surrogate R-squared of the full model is: 
#> [1] 0.30775
# }