Package 'betaNB'

Title: Bootstrap for Regression Effect Sizes
Description: Generates nonparametric bootstrap confidence intervals (Efron and Tibshirani, 1993: <doi:10.1201/9780429246593>) for standardized regression coefficients (beta) and other effect sizes, including multiple correlation, semipartial correlations, squared semipartial correlations, improvement in R-squared, squared partial correlations, Cohen's f-squared, and differences in standardized regression coefficients, for models fitted by lm(). Pairs and wild bootstrap samples are supported.
Authors: Ivan Jacob Agaloos Pesigan [aut, cre, cph] (ORCID: <https://orcid.org/0000-0003-4818-8420>)
Maintainer: Ivan Jacob Agaloos Pesigan <[email protected]>
License: MIT + file LICENSE
Version: 1.1.0
Built: 2026-12-04 06:39:47 UTC
Source: https://github.com/jeksterslab/betaNB

Help Index


Estimate Standardized Regression Coefficients and Generate the Corresponding Sampling Distribution Using Nonparametric Bootstrapping

Description

Estimate Standardized Regression Coefficients and Generate the Corresponding Sampling Distribution Using Nonparametric Bootstrapping

Usage

BetaNB(object, alpha = c(0.05, 0.01, 0.001), std_y = TRUE, std_x = NULL)

Arguments

object

Object of class nb, that is, the output of the NB() function.

alpha

Numeric vector. Significance level α\alpha.

std_y

Logical. Standardize yy. With std_y = FALSE, yy is left in its original units.

std_x

Character vector or NULL. Names of the regressors to standardize. NULL (default) standardizes all regressors; character(0) standardizes none (for example, leave a dummy variable out to keep its 0-1 contrast). The standard deviations are taken from each bootstrap sample.

Details

The vector of standardized regression coefficients (β^\boldsymbol{\hat{\beta}}) is estimated from bootstrap samples. Confidence intervals are the percentiles corresponding to 100(1−α)%100(1 - \alpha)\% of the sampling distribution of β^\boldsymbol{\hat{\beta}}, where α\alpha is the significance level.

Partition the covariance matrix of the outcome and the regressors as

Σ=(σy2σyx′σyxΣx).\boldsymbol{\Sigma} = \begin{pmatrix} \sigma^{2}_{y} & \boldsymbol{\sigma}_{yx}^{\prime} \\ \boldsymbol{\sigma}_{yx} & \boldsymbol{\Sigma}_{x} \end{pmatrix}.

The regression slopes and the standardized regression slopes are

β=Σx−1σyx,βj∗=βjσxjσy,\boldsymbol{\beta} = \boldsymbol{\Sigma}_{x}^{-1} \boldsymbol{\sigma}_{yx}, \quad \beta^{\ast}_{j} = \beta_{j} \frac{\sigma_{x_{j}}}{\sigma_{y}},

where σxj\sigma_{x_{j}} is the standard deviation of regressor jj. With std_y = FALSE, σy\sigma_{y} is replaced by one; for a regressor left out of std_x, σxj\sigma_{x_{j}} is replaced by one. The estimates are computed from the data, the draws β^b∗\hat{\boldsymbol{\beta}}^{\ast}_{b} from each bootstrap covariance matrix Σ^b∗\hat{\boldsymbol{\Sigma}}^{\ast}_{b} (see NB()), and vcov is the sample covariance matrix of the draws.

Value

Returns an object of class betanb which is a list with the following elements:

call

Function call.

args

Function arguments.

thetahatstar

Sampling distribution of β^\boldsymbol{\hat{\beta}}.

jackknife

Jackknife estimates.

vcov

Sampling variance-covariance matrix of β^\boldsymbol{\hat{\beta}}.

est

Vector of estimated β^\boldsymbol{\hat{\beta}}.

fun

Function used ("BetaNB").

Author(s)

Ivan Jacob Agaloos Pesigan

References

Efron, B., & Tibshirani, R. J. (1993). An introduction to the bootstrap. Chapman & Hall. doi:10.1201/9780429246593

See Also

Other Beta Nonparametric Bootstrap Functions: DeltaRSqNB(), DiffBetaNB(), FSqNB(), NB(), PCorNB(), RSqNB(), SCorNB(), SCorSqNB()

Examples

# Data ---------------------------------------------------------------------
data("nas1982", package = "betaNB")

# Fit Model in lm ----------------------------------------------------------
object <- stats::lm(
  formula = QUALITY ~ NARTIC + PCTGRT + PCTSUPP,
  data = nas1982
)

# NB -----------------------------------------------------------------------
nb <- NB(
  object = object,
  R = 100, # use a large value e.g., 5000L for actual research
  seed = 0508
)

# BetaNB -------------------------------------------------------------------
out <- BetaNB(object = nb, alpha = 0.05)

## Methods -----------------------------------------------------------------
print(x = out)
summary(object = out)
coef(object = out)
vcov(object = out)
confint(object = out, level = 0.95)

Estimated Parameter Method for an Object of Class betanb

Description

Estimated Parameter Method for an Object of Class betanb

Usage

## S3 method for class 'betanb'
coef(object, ...)

Arguments

object

Object of Class betanb, that is, the output of the BetaNB(), RSqNB(), SCorNB(), DeltaRSqNB(), PCorNB(), FSqNB(), or DiffBetaNB() functions.

...

additional arguments.

Value

Returns a vector of estimated parameters.

Author(s)

Ivan Jacob Agaloos Pesigan

Examples

# Data ---------------------------------------------------------------------
data("nas1982", package = "betaNB")

# Fit Model in lm ----------------------------------------------------------
object <- stats::lm(
  formula = QUALITY ~ NARTIC + PCTGRT + PCTSUPP,
  data = nas1982
)

# NB -----------------------------------------------------------------------
nb <- NB(
  object = object,
  R = 100, # use a large value e.g., 5000L for actual research
  seed = 0508
)

# BetaNB -------------------------------------------------------------------
out <- BetaNB(object = nb, alpha = 0.05)

## Methods -----------------------------------------------------------------
coef(object = out)

Confidence Intervals Method for an Object of Class betanb

Description

Confidence Intervals Method for an Object of Class betanb

Usage

## S3 method for class 'betanb'
confint(object, parm = NULL, level = 0.95, type = "pc", ...)

Arguments

object

Object of Class betanb, that is, the output of the BetaNB(), RSqNB(), SCorNB(), DeltaRSqNB(), PCorNB(), FSqNB(), or DiffBetaNB() functions.

parm

a specification of which parameters are to be given confidence intervals, either a vector of numbers or a vector of names. If missing, all parameters are considered.

level

the confidence level required.

type

Character string. Confidence interval type, that is, type = "pc" for percentile; type = "bc" for bias corrected; type = "bca" for bias corrected and accelerated; type = "mpc" for modified percentile, available only for DeltaRSqNB() (unadjusted or adj = TRUE).

...

additional arguments.

Details

Let θ^\hat{\theta} be the estimate, θ^1∗,…,θ^R∗\hat{\theta}^{\ast}_{1}, \dots, \hat{\theta}^{\ast}_{R} the bootstrap draws with empirical distribution function G^\hat{G}, Φ\Phi the standard normal distribution function, and zp=Φ−1(p)z_{p} = \Phi^{-1} \left( p \right). The limits of a 100(1−α)%100 \left( 1 - \alpha \right) \% interval are G^−1(p1)\hat{G}^{-1} \left( p_{1} \right) and G^−1(p2)\hat{G}^{-1} \left( p_{2} \right) (type 7 quantiles of the draws). The percentile interval (type = "pc") uses p1=α/2p_{1} = \alpha / 2 and p2=1−α/2p_{2} = 1 - \alpha / 2. The bias-corrected interval (type = "bc") uses

pk=Φ(2z^0+zαk),z^0=Φ−1(1R∑b=1RI(θ^b∗<θ^)),p_{k} = \Phi \left( 2 \hat{z}_{0} + z_{\alpha_{k}} \right), \quad \hat{z}_{0} = \Phi^{-1} \left( \frac{1}{R} \sum_{b = 1}^{R} I \left( \hat{\theta}^{\ast}_{b} < \hat{\theta} \right) \right),

where II is the indicator function, α1=α/2\alpha_{1} = \alpha / 2, and α2=1−α/2\alpha_{2} = 1 - \alpha / 2. The bias-corrected and accelerated interval (type = "bca") uses

pk=Φ(z^0+z^0+zαk1−a^(z^0+zαk)),a^=∑i=1n(θˉ(⋅)−θ^(−i))36[∑i=1n(θˉ(⋅)−θ^(−i))2]3/2,p_{k} = \Phi \left( \hat{z}_{0} + \frac{\hat{z}_{0} + z_{\alpha_{k}}}{1 - \hat{a} \left( \hat{z}_{0} + z_{\alpha_{k}} \right)} \right), \quad \hat{a} = \frac{\sum_{i = 1}^{n} \left( \bar{\theta}_{\left( \cdot \right)} - \hat{\theta}_{\left( -i \right)} \right)^{3}}{6 \left[ \sum_{i = 1}^{n} \left( \bar{\theta}_{\left( \cdot \right)} - \hat{\theta}_{\left( -i \right)} \right)^{2} \right]^{3 / 2}},

where θ^(−i)\hat{\theta}_{\left( -i \right)} is the jackknife estimate without observation ii and θˉ(⋅)\bar{\theta}_{\left( \cdot \right)} is their mean (Efron & Tibshirani, 1993). Failed draws are dropped. The modified percentile interval (type = "mpc") is described in DeltaRSqNB().

Value

Returns a matrix of confidence intervals.

Author(s)

Ivan Jacob Agaloos Pesigan

References

Efron, B., & Tibshirani, R. J. (1993). An introduction to the bootstrap. Chapman & Hall. doi:10.1201/9780429246593

Examples

# Data ---------------------------------------------------------------------
data("nas1982", package = "betaNB")

# Fit Model in lm ----------------------------------------------------------
object <- stats::lm(
  formula = QUALITY ~ NARTIC + PCTGRT + PCTSUPP,
  data = nas1982
)

# NB -----------------------------------------------------------------------
nb <- NB(
  object = object,
  R = 100, # use a large value e.g., 5000L for actual research
  seed = 0508
)

# BetaNB -------------------------------------------------------------------
out <- BetaNB(object = nb, alpha = 0.05)

## Methods -----------------------------------------------------------------
confint(object = out, level = 0.95)

Estimate Improvement in R-Squared and Generate the Corresponding Sampling Distribution Using Nonparametric Bootstrapping

Description

Estimate Improvement in R-Squared and Generate the Corresponding Sampling Distribution Using Nonparametric Bootstrapping

Usage

DeltaRSqNB(object, alpha = c(0.05, 0.01, 0.001), adj = FALSE)

Arguments

object

Object of class nb, that is, the output of the NB() function.

alpha

Numeric vector. Significance level α\alpha.

adj

Logical. Use differences in adjusted R-squared. Default FALSE preserves unadjusted estimates and output.

Details

The vector of improvement in R-squared (ΔR2\Delta R^{2}) is estimated from bootstrap samples. Confidence intervals are the percentiles corresponding to 100(1−α)%100(1 - \alpha)\% of the sampling distribution of ΔR2\Delta R^{2}, where α\alpha is the significance level.

With adj = TRUE, estimates and draws are differences between the adjusted R-squared values of the full model and the model without each regressor. The population target remains the unadjusted increment. Negative adjusted estimates and draws are retained.

With type = "mpc" in confint() or summary(), an unadjusted lower limit is set to zero when the sample F test is nonsignificant. For adjusted estimates, a nonpositive percentile lower limit becomes .001 if significant, or zero if nonsignificant; positive lower limits are retained. Upper limits are unchanged, without clipping. Both modes use the unadjusted sample F statistic and test at the interval's error probability alpha (equality is nonsignificant).

These lower-limit rules follow Algina et al. (2007, p. 210; 2008a, pp. 3–5; 2008b, pp. 735, 737; 2010, pp. 928–929, 931–932). Unlike their ranked endpoints, betaNB retains its ordinary interpolated percentile calculation. Their studies used pairs resampling; coverage for wild draws or heteroskedastic F testing is not established by those studies.

Let β∗\boldsymbol{\beta}^{\ast} be the vector of standardized slopes, Rx\boldsymbol{R}_{x} the correlation matrix of the regressors, rjjr^{jj} the jjth diagonal element of Rx−1\boldsymbol{R}_{x}^{-1}, and R2=β∗′Rxβ∗R^{2} = \boldsymbol{\beta}^{\ast\prime} \boldsymbol{R}_{x} \boldsymbol{\beta}^{\ast}. The semipartial correlation of regressor jj is

srj=βj∗/rjj=βj∗1−Rj⋅−j2,sr_{j} = \beta^{\ast}_{j} / \sqrt{r^{jj}} = \beta^{\ast}_{j} \sqrt{1 - R^{2}_{j \cdot -j}},

where Rj⋅−j2R^{2}_{j \cdot -j} is the R-squared from regressing regressor jj on the other regressors. Its square, srj2sr^{2}_{j}, is the change in R2R^{2} when regressor jj is added last. Because 1/rjj=1−Rj⋅−j21 / r^{jj} = 1 - R^{2}_{j \cdot -j}, srjsr_{j} shrinks toward zero as regressor jj becomes more redundant with the other regressors. The improvement in R-squared for regressor jj is

ΔRj2=R2−R−j2=srj2.\Delta R^{2}_{j} = R^{2} - R^{2}_{-j} = sr^{2}_{j}.

Each effect size is computed from every bootstrap sample (see NB()), and the confidence intervals are percentile-based.

Value

Returns an object of class betanb which is a list with the following elements:

call

Function call.

args

Function arguments.

thetahatstar

Sampling distribution of ΔR2\Delta R^{2}.

vcov

Sampling variance-covariance matrix of ΔR2\Delta R^{2}.

est

Vector of estimated ΔR2\Delta R^{2}.

fun

Estimator label: "DeltaRSqNB" or "DeltaRSqAdjNB".

Author(s)

Ivan Jacob Agaloos Pesigan

References

Algina, J., Keselman, H. J., & Penfield, R. D. (2007). Confidence intervals for an effect size measure in multiple linear regression. Educational and Psychological Measurement, 67(2), 207–218. doi:10.1177/0013164406292030

Algina, J., Keselman, H. J., & Penfield, R. D. (2008a). Confidence intervals for the squared multiple semipartial correlation coefficient. Journal of Modern Applied Statistical Methods, 7(1), 2–10. doi:10.22237/jmasm/1209614460

Algina, J., Keselman, H. J., & Penfield, R. D. (2008b). Note on a confidence interval for the squared semipartial correlation coefficient. Educational and Psychological Measurement, 68(5), 734–741. doi:10.1177/0013164407313371

Algina, J., Keselman, H. J., & Penfield, R. D. (2010). Confidence intervals for squared semipartial correlation coefficients: The effect of nonnormality. Educational and Psychological Measurement, 70(6), 926–940. doi:10.1177/0013164410379335

See Also

Other Beta Nonparametric Bootstrap Functions: BetaNB(), DiffBetaNB(), FSqNB(), NB(), PCorNB(), RSqNB(), SCorNB(), SCorSqNB()

Examples

# Data ---------------------------------------------------------------------
data("nas1982", package = "betaNB")

# Fit Model in lm ----------------------------------------------------------
object <- stats::lm(
  formula = QUALITY ~ NARTIC + PCTGRT + PCTSUPP,
  data = nas1982
)

# NB -----------------------------------------------------------------------
nb <- NB(
  object = object,
  R = 100, # use a large value e.g., 5000L for actual research
  seed = 0508
)

# DeltaRSqNB ---------------------------------------------------------------
out <- DeltaRSqNB(object = nb, alpha = 0.05)

## Methods -----------------------------------------------------------------
print(x = out)
summary(object = out)
coef(object = out)
vcov(object = out)
confint(object = out, level = 0.95)
confint(object = out, level = 0.95, type = "mpc")
adjusted <- DeltaRSqNB(object = nb, alpha = 0.05, adj = TRUE)
confint(object = adjusted, level = 0.95, type = "mpc")

Estimate Differences of Standardized Regression Coefficients and Generate the Corresponding Sampling Distribution Using Nonparametric Bootstrapping

Description

Estimate Differences of Standardized Regression Coefficients and Generate the Corresponding Sampling Distribution Using Nonparametric Bootstrapping

Usage

DiffBetaNB(object, alpha = c(0.05, 0.01, 0.001))

Arguments

object

Object of class nb, that is, the output of the NB() function.

alpha

Numeric vector. Significance level α\alpha.

Details

The vector of differences of standardized regression slopes is estimated from bootstrap samples. Confidence intervals are the percentiles corresponding to 100(1−α)%100(1 - \alpha)\% of the sampling distribution of the differences, where α\alpha is the significance level.

For every pair of regressors j<lj < l, the difference of the standardized regression slopes (see BetaNB()) is

Δβjl∗=βj∗−βl∗,\Delta \beta^{\ast}_{jl} = \beta^{\ast}_{j} - \beta^{\ast}_{l},

computed from the data for the estimate and from each bootstrap sample (see NB()) for the draws.

Value

Returns an object of class betanb which is a list with the following elements:

call

Function call.

args

Function arguments.

thetahatstar

Sampling distribution of differences of standardized regression slopes.

vcov

Sampling variance-covariance matrix of differences of standardized regression slopes.

est

Vector of estimated differences of standardized regression slopes.

fun

Function used ("DiffBetaNB").

Author(s)

Ivan Jacob Agaloos Pesigan

See Also

Other Beta Nonparametric Bootstrap Functions: BetaNB(), DeltaRSqNB(), FSqNB(), NB(), PCorNB(), RSqNB(), SCorNB(), SCorSqNB()

Examples

# Data ---------------------------------------------------------------------
data("nas1982", package = "betaNB")

# Fit Model in lm ----------------------------------------------------------
object <- stats::lm(
  formula = QUALITY ~ NARTIC + PCTGRT + PCTSUPP,
  data = nas1982
)

# NB -----------------------------------------------------------------------
nb <- NB(
  object = object,
  R = 100, # use a large value e.g., 5000L for actual research
  seed = 0508
)

# DiffBetaNB ---------------------------------------------------------------
out <- DiffBetaNB(object = nb, alpha = 0.05)

## Methods -----------------------------------------------------------------
print(x = out)
summary(object = out)
coef(object = out)
vcov(object = out)
confint(object = out, level = 0.95)

Estimate Cohen's f-Squared and Local f-Squared and Generate the Corresponding Sampling Distribution Using Nonparametric Bootstrapping

Description

Estimate Cohen's f-Squared and Local f-Squared and Generate the Corresponding Sampling Distribution Using Nonparametric Bootstrapping

Usage

FSqNB(object, alpha = c(0.05, 0.01, 0.001))

Arguments

object

Object of class nb, that is, the output of the NB() function.

alpha

Numeric vector. Significance level α\alpha.

Details

Let β∗\boldsymbol{\beta}^{\ast} be the vector of standardized slopes, Rx\boldsymbol{R}_{x} the correlation matrix of the regressors, rjjr^{jj} the jjth diagonal element of Rx−1\boldsymbol{R}_{x}^{-1}, and R2=β∗′Rxβ∗R^{2} = \boldsymbol{\beta}^{\ast\prime} \boldsymbol{R}_{x} \boldsymbol{\beta}^{\ast}. The semipartial correlation of regressor jj is

srj=βj∗/rjj=βj∗1−Rj⋅−j2,sr_{j} = \beta^{\ast}_{j} / \sqrt{r^{jj}} = \beta^{\ast}_{j} \sqrt{1 - R^{2}_{j \cdot -j}},

where Rj⋅−j2R^{2}_{j \cdot -j} is the R-squared from regressing regressor jj on the other regressors. Its square, srj2sr^{2}_{j}, is the change in R2R^{2} when regressor jj is added last. Because 1/rjj=1−Rj⋅−j21 / r^{jj} = 1 - R^{2}_{j \cdot -j}, srjsr_{j} shrinks toward zero as regressor jj becomes more redundant with the other regressors. Cohen's f-squared and the local f-squared of regressor jj are

f2=R21−R2,fj2=srj21−R2.f^{2} = \frac{R^{2}}{1 - R^{2}}, \quad f^{2}_{j} = \frac{sr^{2}_{j}}{1 - R^{2}}.

By convention (Cohen, 1988), values of about 0.02, 0.15, and 0.35 are small, medium, and large effects. Each effect size is computed from every bootstrap sample (see NB()), and the confidence intervals are percentile-based.

Value

Returns an object of class betanb which is a list with the following elements:

call

Function call.

args

Function arguments.

thetahatstar

Sampling distribution of f2f^2 (column fsq) and the local f2f^2 (one column per regressor).

jackknife

Jackknife estimates.

vcov

Sampling variance-covariance matrix.

est

Vector of estimates.

fun

Function used ("FSqNB").

Author(s)

Ivan Jacob Agaloos Pesigan

References

Selya, A. S., Rose, J. S., Dierker, L. C., Hedeker, D., & Mermelstein, R. J. (2012). A practical guide to calculating Cohen's f2, a measure of local effect size, from PROC MIXED. Frontiers in Psychology, 3, 111. doi:10.3389/fpsyg.2012.00111

See Also

Other Beta Nonparametric Bootstrap Functions: BetaNB(), DeltaRSqNB(), DiffBetaNB(), NB(), PCorNB(), RSqNB(), SCorNB(), SCorSqNB()

Examples

# Data ---------------------------------------------------------------------
data("nas1982", package = "betaNB")

# Fit Model in lm ----------------------------------------------------------
object <- stats::lm(
  formula = QUALITY ~ NARTIC + PCTGRT + PCTSUPP,
  data = nas1982
)

# NB -----------------------------------------------------------------------
nb <- NB(
  object = object,
  R = 100, # use a large value e.g., 5000L for actual research
  seed = 0508
)

# FSqNB --------------------------------------------------------------------
out <- FSqNB(object = nb, alpha = 0.05)

## Methods -----------------------------------------------------------------
print(x = out)
summary(object = out)
coef(object = out)
vcov(object = out)
confint(object = out, level = 0.95)

1982 National Academy of Sciences Doctoral Programs Data

Description

1982 National Academy of Sciences Doctoral Programs Data

Usage

nas1982

Format

Ratings of 46 doctoral programs in psychology in the USA with the following variables:

QUALITY

Program quality ratings.

NFACUL

Number of faculty members in the program.

NGRADS

Number of program graduates.

PCTSUPP

Percentage of program graduates who received support.

PCTGRT

Percent of faculty members holding research grants.

NARTIC

Number of published articles attributed to program faculty member.

PCTPUB

Percent of faculty with one or more published article.

References

National Research Council. (1982). An assessment of research-doctorate programs in the United States: Social and behavioral sciences. doi:10.17226/9781. Reproduced with permission from the National Academy of Sciences, Courtesy of the National Academies Press, Washington, D.C.


Generate the Sampling Distribution of Sample Covariances Using Nonparametric Bootstrapping

Description

Generate the Sampling Distribution of Sample Covariances Using Nonparametric Bootstrapping

Usage

NB(
  object,
  R = 5000L,
  seed = NULL,
  type = c("pairs", "wild"),
  weights = c("rademacher", "mammen", "webb", "normal"),
  hc = c("hc3", "hc0", "hc1", "hc2", "hc4", "hc4m", "hc5"),
  x = c("random", "fixed")
)

Arguments

object

Object of class lm.

R

Positive integer. Number of bootstrap replications.

seed

Integer. Seed number for reproducibility.

type

Character string. Bootstrap sampler. "pairs" (default) resamples the rows of the data (nonparametric bootstrap). "wild" is the wild bootstrap, which generates yi∗=xi′β^+f(hi)eiviy_i^{*} = \boldsymbol{x}_i^{\prime} \hat{\boldsymbol{\beta}} + f(h_i) e_i v_i, where eie_i is the residual, hih_i is the leverage, viv_i is a random weight with mean 0 and variance 1, and f(hi)f(h_i) is set by hc. The arguments weights, hc, and x are used only with type = "wild".

weights

Character string. Distribution of viv_i: "rademacher" (default; -1 or 1 with equal probability), "mammen" (two-point distribution with third moment 1), "webb" (six-point distribution), or "normal" (standard normal).

hc

Character string. Adjustment of the residuals, with the same definitions as the heteroskedasticity-consistent sampling covariance matrices of betaSandwich: "hc3" (default), "hc0", "hc1", "hc2", "hc4", "hc4m", or "hc5". A leverage equal to 1 is an error for every type except "hc0" and "hc1".

x

Character string. "random" (default) resamples the rows (xi,f(hi)ei)\left( \boldsymbol{x}_i, f(h_i) e_i \right) together before the weights are applied, so the sampling variability of the regressors is kept. "fixed" keeps the regressors of the data in every sample (conditional wild bootstrap); the covariance matrix of the regressors is then the same in every sample.

Details

Let zi=(yi,xi′)′\boldsymbol{z}_{i} = \left( y_{i}, \boldsymbol{x}_{i}^{\prime} \right)^{\prime}, i=1,…,ni = 1, \dots, n, be the outcome and the regressors of observation ii. With type = "pairs", bootstrap sample b=1,…,Rb = 1, \dots, R draws nn rows zb1∗,…,zbn∗\boldsymbol{z}^{\ast}_{b1}, \dots, \boldsymbol{z}^{\ast}_{bn} with replacement, and its sample covariance matrix is

Σ^b∗=1n−1∑i=1n(zbi∗−zˉb∗)(zbi∗−zˉb∗)′.\hat{\boldsymbol{\Sigma}}^{\ast}_{b} = \frac{1}{n - 1} \sum_{i = 1}^{n} \left( \boldsymbol{z}^{\ast}_{bi} - \bar{\boldsymbol{z}}^{\ast}_{b} \right) \left( \boldsymbol{z}^{\ast}_{bi} - \bar{\boldsymbol{z}}^{\ast}_{b} \right)^{\prime}.

With type = "wild", the outcome is generated as described in type, and Σ^b∗\hat{\boldsymbol{\Sigma}}^{\ast}_{b} is computed in the same way. Row bb of thetahatstar is vech⁡(Σ^b∗)\operatorname{vech} \left( \hat{\boldsymbol{\Sigma}}^{\ast}_{b} \right). Row ii of jackknife is vech⁡(Σ^(−i))\operatorname{vech} \left( \hat{\boldsymbol{\Sigma}}_{\left( -i \right)} \right), the sample covariance matrix without observation ii, which gives the acceleration of the bias-corrected and accelerated intervals (see summary.betanb()). An effect size θ=g(Σ)\theta = g \left( \boldsymbol{\Sigma} \right) is computed from every Σ^b∗\hat{\boldsymbol{\Sigma}}^{\ast}_{b}, which gives its sampling distribution θ^1∗,…,θ^R∗\hat{\theta}^{\ast}_{1}, \dots, \hat{\theta}^{\ast}_{R}.

Value

Returns an object of class nb which is a list with the following elements:

call

Function call.

args

Function arguments.

lm_process

Processed lm object.

thetahatstar

Sampling distribution of sample covariances (a matrix; each row is the half-vectorization of one bootstrap covariance matrix).

jackknife

Jackknife estimates (a matrix; each row is the half-vectorization of one leave-one-out covariance matrix).

es

Effect sizes of the bootstrap samples (a list of matrices).

es_jackknife

Effect sizes of the jackknife samples (a list of matrices).

Author(s)

Ivan Jacob Agaloos Pesigan

References

Efron, B., & Tibshirani, R. J. (1993). An introduction to the bootstrap. Chapman & Hall. doi:10.1201/9780429246593

See Also

Other Beta Nonparametric Bootstrap Functions: BetaNB(), DeltaRSqNB(), DiffBetaNB(), FSqNB(), PCorNB(), RSqNB(), SCorNB(), SCorSqNB()

Examples

# Data ---------------------------------------------------------------------
data("nas1982", package = "betaNB")

# Fit Model in lm ----------------------------------------------------------
object <- stats::lm(
  formula = QUALITY ~ NARTIC + PCTGRT + PCTSUPP,
  data = nas1982
)

# NB -----------------------------------------------------------------------
nb <- NB(
  object = object,
  R = 100, # use a large value e.g., 20000L for actual research
  seed = 0508
)
nb
# The `nb` object can be passed as the first argument
# to the following functions
#   - BetaNB
#   - DeltaRSqNB
#   - DiffBetaNB
#   - PCorNB
#   - RSqNB
#   - SCorNB

Estimate Squared Partial Correlation Coefficients and Generate the Corresponding Sampling Distribution Using Nonparametric Bootstrapping

Description

Estimate Squared Partial Correlation Coefficients and Generate the Corresponding Sampling Distribution Using Nonparametric Bootstrapping

Usage

PCorNB(object, alpha = c(0.05, 0.01, 0.001))

Arguments

object

Object of class nb, that is, the output of the NB() function.

alpha

Numeric vector. Significance level α\alpha.

Details

The vector of squared partial correlation coefficients (prj2pr^{2}_{j}) is estimated from bootstrap samples. Confidence intervals are the percentiles corresponding to 100(1−α)%100(1 - \alpha)\% of the sampling distribution of prj2pr^{2}_{j}, where α\alpha is the significance level.

Let β∗\boldsymbol{\beta}^{\ast} be the vector of standardized slopes, Rx\boldsymbol{R}_{x} the correlation matrix of the regressors, rjjr^{jj} the jjth diagonal element of Rx−1\boldsymbol{R}_{x}^{-1}, and R2=β∗′Rxβ∗R^{2} = \boldsymbol{\beta}^{\ast\prime} \boldsymbol{R}_{x} \boldsymbol{\beta}^{\ast}. The semipartial correlation of regressor jj is

srj=βj∗/rjj=βj∗1−Rj⋅−j2,sr_{j} = \beta^{\ast}_{j} / \sqrt{r^{jj}} = \beta^{\ast}_{j} \sqrt{1 - R^{2}_{j \cdot -j}},

where Rj⋅−j2R^{2}_{j \cdot -j} is the R-squared from regressing regressor jj on the other regressors. Its square, srj2sr^{2}_{j}, is the change in R2R^{2} when regressor jj is added last. Because 1/rjj=1−Rj⋅−j21 / r^{jj} = 1 - R^{2}_{j \cdot -j}, srjsr_{j} shrinks toward zero as regressor jj becomes more redundant with the other regressors. The squared partial correlation is

prj2=srj21−R2+srj2,pr^{2}_{j} = \frac{sr^{2}_{j}}{1 - R^{2} + sr^{2}_{j}},

the proportion of the variance in the outcome not explained by the other regressors that is explained by regressor jj. Each effect size is computed from every bootstrap sample (see NB()), and the confidence intervals are percentile-based.

Value

Returns an object of class betanb which is a list with the following elements:

call

Function call.

args

Function arguments.

thetahatstar

Sampling distribution of prj2pr^{2}_{j}.

vcov

Sampling variance-covariance matrix of prj2pr^{2}_{j}.

est

Vector of estimated prj2pr^{2}_{j}.

fun

Function used ("PCorNB").

Author(s)

Ivan Jacob Agaloos Pesigan

See Also

Other Beta Nonparametric Bootstrap Functions: BetaNB(), DeltaRSqNB(), DiffBetaNB(), FSqNB(), NB(), RSqNB(), SCorNB(), SCorSqNB()

Examples

# Data ---------------------------------------------------------------------
data("nas1982", package = "betaNB")

# Fit Model in lm ----------------------------------------------------------
object <- stats::lm(
  formula = QUALITY ~ NARTIC + PCTGRT + PCTSUPP,
  data = nas1982
)

# NB -----------------------------------------------------------------------
nb <- NB(
  object = object,
  R = 100, # use a large value e.g., 5000L for actual research
  seed = 0508
)

# PCorNB -------------------------------------------------------------------
out <- PCorNB(object = nb, alpha = 0.05)

## Methods -----------------------------------------------------------------
print(x = out)
summary(object = out)
coef(object = out)
vcov(object = out)
confint(object = out, level = 0.95)

Print Method for an Object of Class betanb

Description

Print Method for an Object of Class betanb

Usage

## S3 method for class 'betanb'
print(x, alpha = NULL, type = "pc", digits = 4, ...)

Arguments

x

Object of Class betanb, that is, the output of the BetaNB(), RSqNB(), SCorNB(), DeltaRSqNB(), PCorNB(), FSqNB(), or DiffBetaNB() functions.

alpha

Numeric vector. Significance level α\alpha. If alpha = NULL, use the argument alpha used in x.

type

Character string. Confidence interval type, that is, type = "pc" for percentile; type = "bc" for bias corrected; type = "bca" for bias corrected and accelerated; type = "mpc" for modified percentile, available only for DeltaRSqNB() (unadjusted or adj = TRUE).

digits

Digits to print.

...

additional arguments.

Value

Prints a matrix of estimates, standard errors, number of bootstrap replications, and confidence intervals.

Author(s)

Ivan Jacob Agaloos Pesigan

Examples

# Data ---------------------------------------------------------------------
data("nas1982", package = "betaNB")

# Fit Model in lm ----------------------------------------------------------
object <- stats::lm(
  formula = QUALITY ~ NARTIC + PCTGRT + PCTSUPP,
  data = nas1982
)

# NB -----------------------------------------------------------------------
nb <- NB(
  object = object,
  R = 100, # use a large value e.g., 5000L for actual research
  seed = 0508
)

# BetaNB -------------------------------------------------------------------
out <- BetaNB(object = nb, alpha = 0.05)

## Methods -----------------------------------------------------------------
print(x = out)

Print Method for an Object of Class nb

Description

Print Method for an Object of Class nb

Usage

## S3 method for class 'nb'
print(x, ...)

Arguments

x

Object of Class nb.

...

additional arguments.

Value

Prints the first six bootstrap covariance matrices.

Author(s)

Ivan Jacob Agaloos Pesigan

Examples

# Data ---------------------------------------------------------------------
data("nas1982", package = "betaNB")

# Fit Model in lm ----------------------------------------------------------
object <- stats::lm(
  formula = QUALITY ~ NARTIC + PCTGRT + PCTSUPP,
  data = nas1982
)

# NB -----------------------------------------------------------------------
nb <- NB(
  object = object,
  R = 100, # use a large value e.g., 5000L for actual research
  seed = 0508
)

print(x = nb)

Estimate R-Squared and Adjusted R-Squared and Generate the Corresponding Sampling Distribution Using Nonparametric Bootstrapping

Description

Estimate R-Squared and Adjusted R-Squared and Generate the Corresponding Sampling Distribution Using Nonparametric Bootstrapping

Usage

RSqNB(object, alpha = c(0.05, 0.01, 0.001))

Arguments

object

Object of class nb, that is, the output of the NB() function.

alpha

Numeric vector. Significance level α\alpha.

Details

R-squared (R2R^{2}) and adjusted R-squared (Rˉ2\bar{R}^{2}) are estimated from bootstrap samples. Confidence intervals are the percentiles corresponding to 100(1−α)%100(1 - \alpha)\% of the sampling distribution of R2R^{2} and Rˉ2\bar{R}^{2}, where α\alpha is the significance level.

Let β∗\boldsymbol{\beta}^{\ast} be the vector of standardized slopes, Rx\boldsymbol{R}_{x} the correlation matrix of the regressors, rjjr^{jj} the jjth diagonal element of Rx−1\boldsymbol{R}_{x}^{-1}, and R2=β∗′Rxβ∗R^{2} = \boldsymbol{\beta}^{\ast\prime} \boldsymbol{R}_{x} \boldsymbol{\beta}^{\ast}. The R-squared and the adjusted R-squared are

R2=β∗′Rxβ∗,Rˉ2=1−(1−R2)n−1n−k,R^{2} = \boldsymbol{\beta}^{\ast\prime} \boldsymbol{R}_{x} \boldsymbol{\beta}^{\ast}, \quad \bar{R}^{2} = 1 - \left( 1 - R^{2} \right) \frac{n - 1}{n - k},

where nn is the sample size and kk is the number of parameters in the regression model, including the intercept. Each effect size is computed from every bootstrap sample (see NB()), and the confidence intervals are percentile-based.

Value

Returns an object of class betanb which is a list with the following elements:

call

Function call.

args

Function arguments.

thetahatstar

Sampling distribution of R2R^{2} and Rˉ2\bar{R}^{2}.

vcov

Sampling variance-covariance matrix of R2R^{2} and Rˉ2\bar{R}^{2}.

est

Vector of estimated R2R^{2} and Rˉ2\bar{R}^{2}.

fun

Function used ("RSqNB").

Author(s)

Ivan Jacob Agaloos Pesigan

See Also

Other Beta Nonparametric Bootstrap Functions: BetaNB(), DeltaRSqNB(), DiffBetaNB(), FSqNB(), NB(), PCorNB(), SCorNB(), SCorSqNB()

Examples

# Data ---------------------------------------------------------------------
data("nas1982", package = "betaNB")

# Fit Model in lm ----------------------------------------------------------
object <- stats::lm(
  formula = QUALITY ~ NARTIC + PCTGRT + PCTSUPP,
  data = nas1982
)

# NB -----------------------------------------------------------------------
nb <- NB(
  object = object,
  R = 100, # use a large value e.g., 5000L for actual research
  seed = 0508
)

# RSqNB --------------------------------------------------------------------
out <- RSqNB(object = nb, alpha = 0.05)

## Methods -----------------------------------------------------------------
print(x = out)
summary(object = out)
coef(object = out)
vcov(object = out)
confint(object = out, level = 0.95)

Estimate Semipartial Correlation Coefficients and Generate the Corresponding Sampling Distribution Using Nonparametric Bootstrapping

Description

Estimate Semipartial Correlation Coefficients and Generate the Corresponding Sampling Distribution Using Nonparametric Bootstrapping

Usage

SCorNB(object, alpha = c(0.05, 0.01, 0.001))

Arguments

object

Object of class nb, that is, the output of the NB() function.

alpha

Numeric vector. Significance level α\alpha.

Details

The vector of semipartial correlation coefficients (srjsr_{j}) is estimated from bootstrap samples. Confidence intervals are the percentiles corresponding to 100(1−α)%100(1 - \alpha)\% of the sampling distribution of srjsr_{j}, where α\alpha is the significance level.

Let β∗\boldsymbol{\beta}^{\ast} be the vector of standardized slopes, Rx\boldsymbol{R}_{x} the correlation matrix of the regressors, rjjr^{jj} the jjth diagonal element of Rx−1\boldsymbol{R}_{x}^{-1}, and R2=β∗′Rxβ∗R^{2} = \boldsymbol{\beta}^{\ast\prime} \boldsymbol{R}_{x} \boldsymbol{\beta}^{\ast}. The semipartial correlation of regressor jj is

srj=βj∗/rjj=βj∗1−Rj⋅−j2,sr_{j} = \beta^{\ast}_{j} / \sqrt{r^{jj}} = \beta^{\ast}_{j} \sqrt{1 - R^{2}_{j \cdot -j}},

where Rj⋅−j2R^{2}_{j \cdot -j} is the R-squared from regressing regressor jj on the other regressors. Its square, srj2sr^{2}_{j}, is the change in R2R^{2} when regressor jj is added last. Because 1/rjj=1−Rj⋅−j21 / r^{jj} = 1 - R^{2}_{j \cdot -j}, srjsr_{j} shrinks toward zero as regressor jj becomes more redundant with the other regressors. The sign of srjsr_{j} follows the sign of βj∗\beta^{\ast}_{j}. Each effect size is computed from every bootstrap sample (see NB()), and the confidence intervals are percentile-based.

Value

Returns an object of class betanb which is a list with the following elements:

call

Function call.

args

Function arguments.

thetahatstar

Sampling distribution of srjsr_{j}.

vcov

Sampling variance-covariance matrix of srjsr_{j}.

est

Vector of estimated srjsr_{j}.

fun

Function used ("SCorNB").

Author(s)

Ivan Jacob Agaloos Pesigan

See Also

Other Beta Nonparametric Bootstrap Functions: BetaNB(), DeltaRSqNB(), DiffBetaNB(), FSqNB(), NB(), PCorNB(), RSqNB(), SCorSqNB()

Examples

# Data ---------------------------------------------------------------------
data("nas1982", package = "betaNB")

# Fit Model in lm ----------------------------------------------------------
object <- stats::lm(
  formula = QUALITY ~ NARTIC + PCTGRT + PCTSUPP,
  data = nas1982
)

# NB -----------------------------------------------------------------------
nb <- NB(
  object = object,
  R = 100, # use a large value e.g., 5000L for actual research
  seed = 0508
)

# SCorNB -------------------------------------------------------------------
out <- SCorNB(object = nb, alpha = 0.05)

## Methods -----------------------------------------------------------------
print(x = out)
summary(object = out)
coef(object = out)
vcov(object = out)
confint(object = out, level = 0.95)

Estimate Squared Semipartial Correlation Coefficients and the Corresponding Confidence Intervals From the Signed Intervals

Description

Square the signed interval as a set, with lower limit zero if it contains zero. This differs from an interval of squared draws. No draws are generated and no endpoints are clipped to one. Failed signed endpoints remain missing.

Usage

SCorSqNB(object, level = 0.95, type = "pc")

Arguments

object

Context accepted by SCorNB().

level

Single confidence level in (0, 1).

type

Signed bootstrap interval: pc, bc, or bca.

Details

The semipartial correlation srjsr_{j} (see SCorNB()) is signed, and its confidence interval [l,u]\left[ l, u \right] may contain zero. The interval for srj2sr^{2}_{j} is the image of that interval under squaring. The squared interval is [l2,u2]\left[ l^{2}, u^{2} \right] if 0<l0 < l, [u2,l2]\left[ u^{2}, l^{2} \right] if u<0u < 0, and [0,max⁡(l2,u2)]\left[ 0, \max \left( l^{2}, u^{2} \right) \right] if the signed interval contains zero. This is not the interval of squared draws, and it is not an interval for DeltaRSqNB().

Value

Data frame with est, lower and upper columns and predictor row names. The point estimate is the squared signed estimate. No standard error is implied by this interval transformation.

Author(s)

Ivan Jacob Agaloos Pesigan

See Also

Other Beta Nonparametric Bootstrap Functions: BetaNB(), DeltaRSqNB(), DiffBetaNB(), FSqNB(), NB(), PCorNB(), RSqNB(), SCorNB()

Examples

# Data ---------------------------------------------------------------------
data("nas1982", package = "betaNB")

# Fit Model in lm ----------------------------------------------------------
object <- stats::lm(
  formula = QUALITY ~ NARTIC + PCTGRT + PCTSUPP,
  data = nas1982
)

# NB -----------------------------------------------------------------------
nb <- NB(
  object = object,
  R = 100, # use a large value e.g., 5000L for actual research
  seed = 0508
)

# SCorSqNB -----------------------------------------------------------------
SCorSqNB(object = nb, level = 0.95, type = "pc")

Summary Method for an Object of Class betanb

Description

Summary Method for an Object of Class betanb

Usage

## S3 method for class 'betanb'
summary(object, alpha = NULL, type = "pc", digits = 4, ...)

Arguments

object

Object of Class betanb, that is, the output of the BetaNB(), RSqNB(), SCorNB(), DeltaRSqNB(), PCorNB(), FSqNB(), or DiffBetaNB() functions.

alpha

Numeric vector. Significance level α\alpha. If alpha = NULL, use the argument alpha used in object.

type

Character string. Confidence interval type, that is, type = "pc" for percentile; type = "bc" for bias corrected; type = "bca" for bias corrected and accelerated; type = "mpc" for modified percentile, available only for DeltaRSqNB() (unadjusted or adj = TRUE).

digits

Digits to print.

...

additional arguments.

Details

Let θ^\hat{\theta} be the estimate, θ^1∗,…,θ^R∗\hat{\theta}^{\ast}_{1}, \dots, \hat{\theta}^{\ast}_{R} the bootstrap draws with empirical distribution function G^\hat{G}, Φ\Phi the standard normal distribution function, and zp=Φ−1(p)z_{p} = \Phi^{-1} \left( p \right). The limits of a 100(1−α)%100 \left( 1 - \alpha \right) \% interval are G^−1(p1)\hat{G}^{-1} \left( p_{1} \right) and G^−1(p2)\hat{G}^{-1} \left( p_{2} \right) (type 7 quantiles of the draws). The percentile interval (type = "pc") uses p1=α/2p_{1} = \alpha / 2 and p2=1−α/2p_{2} = 1 - \alpha / 2. The bias-corrected interval (type = "bc") uses

pk=Φ(2z^0+zαk),z^0=Φ−1(1R∑b=1RI(θ^b∗<θ^)),p_{k} = \Phi \left( 2 \hat{z}_{0} + z_{\alpha_{k}} \right), \quad \hat{z}_{0} = \Phi^{-1} \left( \frac{1}{R} \sum_{b = 1}^{R} I \left( \hat{\theta}^{\ast}_{b} < \hat{\theta} \right) \right),

where II is the indicator function, α1=α/2\alpha_{1} = \alpha / 2, and α2=1−α/2\alpha_{2} = 1 - \alpha / 2. The bias-corrected and accelerated interval (type = "bca") uses

pk=Φ(z^0+z^0+zαk1−a^(z^0+zαk)),a^=∑i=1n(θˉ(⋅)−θ^(−i))36[∑i=1n(θˉ(⋅)−θ^(−i))2]3/2,p_{k} = \Phi \left( \hat{z}_{0} + \frac{\hat{z}_{0} + z_{\alpha_{k}}}{1 - \hat{a} \left( \hat{z}_{0} + z_{\alpha_{k}} \right)} \right), \quad \hat{a} = \frac{\sum_{i = 1}^{n} \left( \bar{\theta}_{\left( \cdot \right)} - \hat{\theta}_{\left( -i \right)} \right)^{3}}{6 \left[ \sum_{i = 1}^{n} \left( \bar{\theta}_{\left( \cdot \right)} - \hat{\theta}_{\left( -i \right)} \right)^{2} \right]^{3 / 2}},

where θ^(−i)\hat{\theta}_{\left( -i \right)} is the jackknife estimate without observation ii and θˉ(⋅)\bar{\theta}_{\left( \cdot \right)} is their mean (Efron & Tibshirani, 1993). Failed draws are dropped. The modified percentile interval (type = "mpc") is described in DeltaRSqNB().

Value

Returns a matrix of estimates, standard errors, number of bootstrap replications, and confidence intervals.

Author(s)

Ivan Jacob Agaloos Pesigan

References

Efron, B., & Tibshirani, R. J. (1993). An introduction to the bootstrap. Chapman & Hall. doi:10.1201/9780429246593

Examples

# Data ---------------------------------------------------------------------
data("nas1982", package = "betaNB")

# Fit Model in lm ----------------------------------------------------------
object <- stats::lm(
  formula = QUALITY ~ NARTIC + PCTGRT + PCTSUPP,
  data = nas1982
)

# NB -----------------------------------------------------------------------
nb <- NB(
  object = object,
  R = 100, # use a large value e.g., 5000L for actual research
  seed = 0508
)

# BetaNB -------------------------------------------------------------------
out <- BetaNB(object = nb, alpha = 0.05)

## Methods -----------------------------------------------------------------
summary(object = out)

Sampling Variance-Covariance Matrix Method for an Object of Class betanb

Description

Sampling Variance-Covariance Matrix Method for an Object of Class betanb

Usage

## S3 method for class 'betanb'
vcov(object, ...)

Arguments

object

Object of Class betanb, that is, the output of the BetaNB(), RSqNB(), SCorNB(), DeltaRSqNB(), PCorNB(), FSqNB(), or DiffBetaNB() functions.

...

additional arguments.

Value

Returns the variance-covariance matrix of estimates.

Author(s)

Ivan Jacob Agaloos Pesigan

Examples

# Data ---------------------------------------------------------------------
data("nas1982", package = "betaNB")

# Fit Model in lm ----------------------------------------------------------
object <- stats::lm(
  formula = QUALITY ~ NARTIC + PCTGRT + PCTSUPP,
  data = nas1982
)

# NB -----------------------------------------------------------------------
nb <- NB(
  object = object,
  R = 100, # use a large value e.g., 5000L for actual research
  seed = 0508
)

# BetaNB -------------------------------------------------------------------
out <- BetaNB(object = nb, alpha = 0.05)

## Methods -----------------------------------------------------------------
vcov(object = out)