A function to calculate the interval estimate of the surrogate R-squared measure
Source:R/surr_rsq_ci.R
surr_rsq_ci.Rd
This function generates the interval measure of surrogate R-squared by bootstrap.
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
, anddata
.- 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.
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.