Skip to contents

This function generates the interval measure of surrogate R-squared by bootstrap.

Usage

surr_rsq_ci(
  object,
  alpha = 0.05,
  B = 2000,
  asym = FALSE,
  parallel = FALSE,
  ...
)

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.

alpha

The significance level alpha. The confidence level is 1-alpha.

B

The number of bootstrap replications.

asym

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

parallel

logical argument whether conduct parallel for bootstrapping surrogate R-squared to construct the interval estimate. The clusters need to be registered through registerDoParallel(cl) beforehand.

...

Additional optional arguments.

Value

An list that contains the CI_lower, CI_upper.

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)

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

select_model <- update(fullmodel, formula. = ". ~ . - fixed.acidity -
citric.acid - residual.sugar - density")

surr_rsq_select <- surr_rsq(select_model, fullmodel, data = RedWine, avg.num = 30)

# surr_rsq_ci(surr_rsq_select, alpha = 0.05, B = 2000, parallel = FALSE) # Not run, it takes time.

# surr_rsq_ci(surr_rsq_select, alpha = 0.05, B = 2000, parallel = TRUE) # Not run, it takes time.