Skip to contents

It can provide the surrogate R-squared for a user specified model. This function will generate an S3 object of surrogate R-squared measure that will be called from other functions of this package. The generic S3 function print is also developed to present the surrogate R-squared measure.

Usage

surr_rsq(model, full_model, avg.num = 30, asym = FALSE, newdata = NULL, ...)

Arguments

model

A reduced model that needs to be investigated. The reported surrogate R-squared is for this reduced model.

full_model

A full model that contains all of the predictors in the data set. This model object should also contain the dataset for fitting the full model and the reduced model in the first argument.

avg.num

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

asym

A logical argument whether use the asymptotic version of our surrogate R-squared. More details are in the paper Liu et al. (2023).

...

Additional optional arguments.

Value

An object of class "surr_rsq" is a list containing the following components:

surr_rsq

the surrogate R-squared value;

reduced_model

the reduced model under investigation. It should be a subset of the full model;

full_model

the full model used for generating the surrogate response. It should have passed initial variable screening and model diagnostics (see Paper for reference);

data

the dataset contains the response variable and all the predictors.

References

Zhu, X., Liu, D., Lin, Z., Greenwell, B. (2022). SurrogateRsq: an R package for categorical data goodness-of-fit analysis using the surrogate R-squared

Liu, D., Zhu, X., Greenwell, B., & Lin, Z. (2023). A new goodness‐of‐fit measure for probit models: Surrogate R2. British Journal of Mathematical and Statistical Psychology, 76(1), 192-210.

Examples

data("RedWine")

full_formula <- as.formula(quality ~ fixed.acidity + volatile.acidity +
citric.acid+ residual.sugar + chlorides + free.sulfur.dioxide +
total.sulfur.dioxide + density + pH + sulphates + alcohol)

full_mod <- polr(formula = full_formula,
data=RedWine, method  = "probit")

select_model <- update(full_mod, formula. = ". ~ . - fixed.acidity -
citric.acid - residual.sugar - density")
surr_obj_sele_mod <- surr_rsq(model = select_model, full_model = full_mod,
                               data = RedWine, avg.num = 30)
print(surr_obj_sele_mod$surr_rsq, digits = 3)
#> [1] 0.41