Package 'betaSandwich'

Title: Robust Confidence Intervals for Standardized Regression Coefficients
Description: Generates robust confidence intervals for standardized regression coefficients using heteroskedasticity-consistent standard errors for models fitted by lm() as described in Dudgeon (2017) <doi:10.1007/s11336-017-9563-z>. Sampling covariance matrices can also be obtained under multivariate normal theory and the asymptotically distribution-free approach. The package can also be used to generate confidence intervals for R-squared, adjusted R-squared, differences of standardized regression coefficients, semipartial correlations, squared partial correlations, the improvement in R-squared, and Cohen's f-squared. A description of the package and code examples are presented in Pesigan, Sun, and Cheung (2023) <doi:10.1080/00273171.2023.2201277>.
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:23 UTC
Source: https://github.com/jeksterslab/betaSandwich

Help Index


Estimate Standardized Regression Coefficients and the Corresponding Sampling Covariance Matrix Using the Asymptotic Distribution-Free Approach

Description

Estimate Standardized Regression Coefficients and the Corresponding Sampling Covariance Matrix Using the Asymptotic Distribution-Free Approach

Usage

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

Arguments

object

Object of class lm.

alpha

Numeric vector. Significance level α\alpha.

std_y

Logical. Standardize yy. With std_y = FALSE, yy is left in its original units (bjσxjb_j \sigma_{x_j}).

std_x

Character vector or NULL. Names of the regressors to standardize. NULL (default) standardizes all regressors; character(0) standardizes none (bj/σyb_j / \sigma_y). Leaving a dummy variable out keeps its 0-1 contrast. The delta method accounts for the sampling variability of the standard deviations.

Details

Note that while the calculation in BetaADF() is different from betaDelta::BetaDelta() with type = "adf", the results are numerically equivalent. BetaADF() is appropriate when sample sizes are moderate to large (n > 250). BetaHC() is recommended in most situations.

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.

Let θ∗\boldsymbol{\theta}^{\ast} collect the standardized slopes, σy\sigma_{y}, the standard deviations of the regressors, and the correlations of the regressors, and let J=∂vech⁡(Σ)/∂θ∗′\boldsymbol{J} = \partial \operatorname{vech} \left( \boldsymbol{\Sigma} \right) / \partial \boldsymbol{\theta}^{\ast \prime} be the Jacobian of the implied covariance matrix, evaluated at the estimates (Dudgeon, 2017). The asymptotically distribution-free sampling covariance matrix is

var⁡^(θ^∗)=1n(J′Γ^−1J)−1,\widehat{\operatorname{var}} \left( \hat{\boldsymbol{\theta}}^{\ast} \right) = \frac{1}{n} \left( \boldsymbol{J}^{\prime} \hat{\boldsymbol{\Gamma}}^{-1} \boldsymbol{J} \right)^{-1},

where Γ^\hat{\boldsymbol{\Gamma}} is the unbiased estimator

Γ^=n(n−1)(n−2)(n−3)Γ^ADF−n(n−2)(n−3)(Γ^N−2n−1vech⁡(S~)vech⁡(S~)′),\hat{\boldsymbol{\Gamma}} = \frac{n \left( n - 1 \right)}{\left( n - 2 \right) \left( n - 3 \right)} \hat{\boldsymbol{\Gamma}}_{\mathrm{ADF}} - \frac{n}{\left( n - 2 \right) \left( n - 3 \right)} \left( \hat{\boldsymbol{\Gamma}}_{\mathrm{N}} - \frac{2}{n - 1} \operatorname{vech} \left( \tilde{\boldsymbol{S}} \right) \operatorname{vech} \left( \tilde{\boldsymbol{S}} \right)^{\prime} \right),

S~\tilde{\boldsymbol{S}} is the covariance matrix with divisor nn, Γ^N\hat{\boldsymbol{\Gamma}}_{\mathrm{N}} is the normal-theory matrix (see BetaN()) at S~\tilde{\boldsymbol{S}}, and

Γ^ADF=1n∑i=1n[vech⁡(didi′)−vech⁡(S~)][vech⁡(didi′)−vech⁡(S~)]′,\hat{\boldsymbol{\Gamma}}_{\mathrm{ADF}} = \frac{1}{n} \sum_{i = 1}^{n} \left[ \operatorname{vech} \left( \boldsymbol{d}_{i} \boldsymbol{d}_{i}^{\prime} \right) - \operatorname{vech} \left( \tilde{\boldsymbol{S}} \right) \right] \left[ \operatorname{vech} \left( \boldsymbol{d}_{i} \boldsymbol{d}_{i}^{\prime} \right) - \operatorname{vech} \left( \tilde{\boldsymbol{S}} \right) \right]^{\prime},

with di\boldsymbol{d}_{i} the deviation of observation ii from the sample means. The block of the standardized slopes is returned. The confidence intervals are β^j∗±t1−α/2,n−kse⁡^(β^j∗)\hat{\beta}^{\ast}_{j} \pm t_{1 - \alpha / 2, n - k} \widehat{\operatorname{se}} \left( \hat{\beta}^{\ast}_{j} \right), where kk is the number of regression parameters, including the intercept.

Value

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

call

Function call.

args

Function arguments.

lm_process

Processed lm object.

gamma_n

Asymptotic covariance matrix of the sample covariance matrix assuming multivariate normality.

gamma_hc

Asymptotic covariance matrix HC correction.

gamma

Asymptotic covariance matrix of the sample covariance matrix.

acov

Asymptotic covariance matrix of the standardized slopes.

vcov

Sampling covariance matrix of the standardized slopes.

est

Vector of standardized slopes.

Author(s)

Ivan Jacob Agaloos Pesigan

References

Browne, M. W. (1984). Asymptotically distribution-free methods for the analysis of covariance structures. British Journal of Mathematical and Statistical Psychology, 37(1), 62–83. doi:10.1111/j.2044-8317.1984.tb00789.x

Dudgeon, P. (2017). Some improvements in confidence intervals for standardized regression coefficients. Psychometrika, 82(4), 928–951. doi:10.1007/s11336-017-9563-z

Pesigan, I. J. A., Sun, R. W., & Cheung, S. F. (2023). betaDelta and betaSandwich: Confidence intervals for standardized regression coefficients in R. Multivariate Behavioral Research. doi:10.1080/00273171.2023.2201277

See Also

Other Beta Sandwich Functions: BetaHC(), BetaN(), DeltaRSqSandwich(), DiffBetaSandwich(), FSqSandwich(), PCorSandwich(), RSqSandwich(), SCorSandwich(), SCorSqSandwich()

Examples

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

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

# BetaADF ------------------------------------------------------------------
std <- BetaADF(object = object)

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

Estimate Standardized Regression Coefficients and the Corresponding Robust Sampling Covariance Matrix Using the Heteroskedasticity Consistent Approach

Description

Estimate Standardized Regression Coefficients and the Corresponding Robust Sampling Covariance Matrix Using the Heteroskedasticity Consistent Approach

Usage

BetaHC(
  object,
  type = "hc3",
  alpha = c(0.05, 0.01, 0.001),
  std_y = TRUE,
  std_x = NULL,
  g1 = 1,
  g2 = 1.5,
  k = 0.7
)

Arguments

object

Object of class lm.

type

Character string. Correction type. Possible values are "hc0", "hc1", "hc2", "hc3", "hc4", "hc4m", and "hc5".

alpha

Numeric vector. Significance level α\alpha.

std_y

Logical. Standardize yy. With std_y = FALSE, yy is left in its original units (bjσxjb_j \sigma_{x_j}).

std_x

Character vector or NULL. Names of the regressors to standardize. NULL (default) standardizes all regressors; character(0) standardizes none (bj/σyb_j / \sigma_y). Leaving a dummy variable out keeps its 0-1 contrast. The delta method accounts for the sampling variability of the standard deviations.

g1

Numeric. g1 value for type = "hc4m".

g2

Numeric. g2 value for type = "hc4m".

k

Numeric. Constant k for type = "hc5" 0≤k≤10 \leq k \leq 1.

Details

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.

Let θ∗\boldsymbol{\theta}^{\ast} collect the standardized slopes, σy\sigma_{y}, the standard deviations of the regressors, and the correlations of the regressors, and let J=∂vech⁡(Σ)/∂θ∗′\boldsymbol{J} = \partial \operatorname{vech} \left( \boldsymbol{\Sigma} \right) / \partial \boldsymbol{\theta}^{\ast \prime} be the Jacobian of the implied covariance matrix, evaluated at the estimates (Dudgeon, 2017). The heteroskedasticity-consistent sampling covariance matrix is the sandwich

var⁡^(θ^∗)=n(n−1)2B−1J′Γ^N−1Γ^HCΓ^N−1JB−1,B=J′Γ^N−1J,\widehat{\operatorname{var}} \left( \hat{\boldsymbol{\theta}}^{\ast} \right) = \frac{n}{\left( n - 1 \right)^{2}} \boldsymbol{B}^{-1} \boldsymbol{J}^{\prime} \hat{\boldsymbol{\Gamma}}_{\mathrm{N}}^{-1} \hat{\boldsymbol{\Gamma}}_{\mathrm{HC}} \hat{\boldsymbol{\Gamma}}_{\mathrm{N}}^{-1} \boldsymbol{J} \boldsymbol{B}^{-1}, \quad \boldsymbol{B} = \boldsymbol{J}^{\prime} \hat{\boldsymbol{\Gamma}}_{\mathrm{N}}^{-1} \boldsymbol{J},

where Γ^N\hat{\boldsymbol{\Gamma}}_{\mathrm{N}} is the normal-theory matrix (see BetaN()) and

Γ^HC=1n∑i=1nqivivi′,vi=vech⁡(didi′)−vech⁡(S),\hat{\boldsymbol{\Gamma}}_{\mathrm{HC}} = \frac{1}{n} \sum_{i = 1}^{n} q_{i} \boldsymbol{v}_{i} \boldsymbol{v}_{i}^{\prime}, \quad \boldsymbol{v}_{i} = \operatorname{vech} \left( \boldsymbol{d}_{i} \boldsymbol{d}_{i}^{\prime} \right) - \operatorname{vech} \left( \boldsymbol{S} \right),

with di\boldsymbol{d}_{i} the deviation of observation ii from the sample means. The weight qiq_{i} depends on the leverage hih_{i}, the number of regression parameters kk (including the intercept), and type: qi=1q_{i} = 1 ("hc0", "hc1"), (1−hi)−1\left( 1 - h_{i} \right)^{-1} ("hc2"), (1−hi)−2\left( 1 - h_{i} \right)^{-2} ("hc3"), (1−hi)−δi\left( 1 - h_{i} \right)^{-\delta_{i}} with δi=min⁡(4,nhi/k)\delta_{i} = \min \left( 4, n h_{i} / k \right) ("hc4"), (1−hi)−λi\left( 1 - h_{i} \right)^{-\lambda_{i}} with λi=min⁡(g1,nhi/k)+min⁡(g2,nhi/k)\lambda_{i} = \min \left( g_{1}, n h_{i} / k \right) + \min \left( g_{2}, n h_{i} / k \right) ("hc4m"), and (1−hi)−γi/2\left( 1 - h_{i} \right)^{-\gamma_{i} / 2} with γi=min⁡(nhi/k,max⁡(4,ncmax⁡lhl/k))\gamma_{i} = \min \left( n h_{i} / k, \max \left( 4, n c \max_{l} h_{l} / k \right) \right) ("hc5", where cc is the argument k). With "hc1", the matrix is multiplied by n/(n−k)n / \left( n - k \right). The block of the standardized slopes is returned. The confidence intervals are β^j∗±t1−α/2,n−kse⁡^(β^j∗)\hat{\beta}^{\ast}_{j} \pm t_{1 - \alpha / 2, n - k} \widehat{\operatorname{se}} \left( \hat{\beta}^{\ast}_{j} \right), where kk is the number of regression parameters, including the intercept.

Value

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

call

Function call.

args

Function arguments.

lm_process

Processed lm object.

gamma_n

Asymptotic covariance matrix of the sample covariance matrix assuming multivariate normality.

gamma_hc

Asymptotic covariance matrix HC correction.

gamma

Asymptotic covariance matrix of the sample covariance matrix.

acov

Asymptotic covariance matrix of the standardized slopes.

vcov

Sampling covariance matrix of the standardized slopes.

est

Vector of standardized slopes.

Author(s)

Ivan Jacob Agaloos Pesigan

References

Dudgeon, P. (2017). Some improvements in confidence intervals for standardized regression coefficients. Psychometrika, 82(4), 928–951. doi:10.1007/s11336-017-9563-z

Pesigan, I. J. A., Sun, R. W., & Cheung, S. F. (2023). betaDelta and betaSandwich: Confidence intervals for standardized regression coefficients in R. Multivariate Behavioral Research. doi:10.1080/00273171.2023.2201277

See Also

Other Beta Sandwich Functions: BetaADF(), BetaN(), DeltaRSqSandwich(), DiffBetaSandwich(), FSqSandwich(), PCorSandwich(), RSqSandwich(), SCorSandwich(), SCorSqSandwich()

Examples

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

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

# BetaHC -------------------------------------------------------------------
std <- BetaHC(object = object)

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

Estimate Standardized Regression Coefficients and the Corresponding Sampling Covariance Matrix Assuming Multivariate Normality

Description

Estimate Standardized Regression Coefficients and the Corresponding Sampling Covariance Matrix Assuming Multivariate Normality

Usage

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

Arguments

object

Object of class lm.

alpha

Numeric vector. Significance level α\alpha.

std_y

Logical. Standardize yy. With std_y = FALSE, yy is left in its original units (bjσxjb_j \sigma_{x_j}).

std_x

Character vector or NULL. Names of the regressors to standardize. NULL (default) standardizes all regressors; character(0) standardizes none (bj/σyb_j / \sigma_y). Leaving a dummy variable out keeps its 0-1 contrast. The delta method accounts for the sampling variability of the standard deviations.

Details

Note that while the calculation in BetaN() is different from betaDelta::BetaDelta() with type = "mvn", the results are numerically equivalent. BetaN() assumes multivariate normality. BetaHC() is recommended in most situations.

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.

Let θ∗\boldsymbol{\theta}^{\ast} collect the standardized slopes, σy\sigma_{y}, the standard deviations of the regressors, and the correlations of the regressors, and let J=∂vech⁡(Σ)/∂θ∗′\boldsymbol{J} = \partial \operatorname{vech} \left( \boldsymbol{\Sigma} \right) / \partial \boldsymbol{\theta}^{\ast \prime} be the Jacobian of the implied covariance matrix, evaluated at the estimates (Dudgeon, 2017). Under multivariate normality,

var⁡^(θ^∗)=1n(J′Γ^N−1J)−1,Γ^N=2D+(S⊗S)D+′,\widehat{\operatorname{var}} \left( \hat{\boldsymbol{\theta}}^{\ast} \right) = \frac{1}{n} \left( \boldsymbol{J}^{\prime} \hat{\boldsymbol{\Gamma}}_{\mathrm{N}}^{-1} \boldsymbol{J} \right)^{-1}, \quad \hat{\boldsymbol{\Gamma}}_{\mathrm{N}} = 2 \boldsymbol{D}^{+} \left( \boldsymbol{S} \otimes \boldsymbol{S} \right) \boldsymbol{D}^{+ \prime},

where S\boldsymbol{S} is the sample covariance matrix and D+\boldsymbol{D}^{+} is the Moore-Penrose inverse of the duplication matrix. The block of the standardized slopes is returned. The confidence intervals are β^j∗±t1−α/2,n−kse⁡^(β^j∗)\hat{\beta}^{\ast}_{j} \pm t_{1 - \alpha / 2, n - k} \widehat{\operatorname{se}} \left( \hat{\beta}^{\ast}_{j} \right), where kk is the number of regression parameters, including the intercept.

Value

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

call

Function call.

args

Function arguments.

lm_process

Processed lm object.

gamma_n

Asymptotic covariance matrix of the sample covariance matrix assuming multivariate normality.

gamma_hc

Asymptotic covariance matrix HC correction.

gamma

Asymptotic covariance matrix of the sample covariance matrix.

acov

Asymptotic covariance matrix of the standardized slopes.

vcov

Sampling covariance matrix of the standardized slopes.

est

Vector of standardized slopes.

Author(s)

Ivan Jacob Agaloos Pesigan

References

Dudgeon, P. (2017). Some improvements in confidence intervals for standardized regression coefficients. Psychometrika, 82(4), 928–951. doi:10.1007/s11336-017-9563-z

Pesigan, I. J. A., Sun, R. W., & Cheung, S. F. (2023). betaDelta and betaSandwich: Confidence intervals for standardized regression coefficients in R. Multivariate Behavioral Research. doi:10.1080/00273171.2023.2201277

See Also

Other Beta Sandwich Functions: BetaADF(), BetaHC(), DeltaRSqSandwich(), DiffBetaSandwich(), FSqSandwich(), PCorSandwich(), RSqSandwich(), SCorSandwich(), SCorSqSandwich()

Examples

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

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

# BetaN --------------------------------------------------------------------
std <- BetaN(object = object)

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

Standardized Regression Slopes

Description

Standardized Regression Slopes

Usage

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

Arguments

object

Object of class betasandwich.

...

additional arguments.

Value

Returns a vector of standardized regression slopes.

Author(s)

Ivan Jacob Agaloos Pesigan

Examples

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

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

# BetaHC -------------------------------------------------------------------
std <- BetaHC(object = object)

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

Estimates for an Object of Class essandwich

Description

Estimates for an Object of Class essandwich

Usage

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

Arguments

object

Object of class essandwich.

...

additional arguments.

Value

Returns a vector of estimates.

Author(s)

Ivan Jacob Agaloos Pesigan

Examples

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

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

# BetaHC -------------------------------------------------------------------
std <- BetaHC(object = object)

# RSqSandwich --------------------------------------------------------------
out <- RSqSandwich(object = std)

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

Confidence Intervals for Standardized Regression Slopes

Description

Confidence Intervals for Standardized Regression Slopes

Usage

## S3 method for class 'betasandwich'
confint(object, parm = NULL, level = 0.95, ...)

Arguments

object

Object of class betasandwich.

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.

...

additional arguments.

Details

The confidence intervals are θ^±t1−α/2,n−kse⁡^(θ^)\hat{\theta} \pm t_{1 - \alpha / 2, n - k} \widehat{\operatorname{se}} \left( \hat{\theta} \right), where se⁡^\widehat{\operatorname{se}} is the square root of the diagonal of the sampling covariance matrix (see BetaHC(), BetaN(), and BetaADF()), nn is the sample size, and kk is the number of regression parameters, including the intercept. The test statistic is θ^/se⁡^(θ^)\hat{\theta} / \widehat{\operatorname{se}} \left( \hat{\theta} \right) with n−kn - k degrees of freedom.

Value

Returns a matrix of confidence intervals.

Author(s)

Ivan Jacob Agaloos Pesigan

Examples

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

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

# BetaHC -------------------------------------------------------------------
std <- BetaHC(object = object)

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

Confidence Intervals for an Object of Class essandwich

Description

Confidence Intervals for an Object of Class essandwich

Usage

## S3 method for class 'essandwich'
confint(object, parm = NULL, level = 0.95, ...)

Arguments

object

Object of class essandwich.

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.

...

additional arguments.

Details

The confidence intervals are θ^±z1−α/2se⁡^(θ^)\hat{\theta} \pm z_{1 - \alpha / 2} \widehat{\operatorname{se}} \left( \hat{\theta} \right), where se⁡^\widehat{\operatorname{se}} is the square root of the diagonal of the delta-method sampling covariance matrix of the effect size, and zpz_{p} is the pp quantile of the standard normal distribution. The test statistic is z=θ^/se⁡^(θ^)z = \hat{\theta} / \widehat{\operatorname{se}} \left( \hat{\theta} \right).

Value

Returns a matrix of confidence intervals.

Author(s)

Ivan Jacob Agaloos Pesigan

Examples

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

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

# BetaHC -------------------------------------------------------------------
std <- BetaHC(object = object)

# RSqSandwich --------------------------------------------------------------
out <- RSqSandwich(object = std)

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

Estimate Improvement in R-Squared and the Corresponding Sampling Covariance Matrix

Description

Estimate Improvement in R-Squared and the Corresponding Sampling Covariance Matrix

Usage

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

Arguments

object

Object of class betasandwich, that is, the output of the BetaHC(), BetaN(), or BetaADF() functions.

alpha

Numeric vector. Significance level α\alpha.

Details

The sampling covariance matrix is obtained by the delta method from the sampling covariance matrix of the standardized parameters stored in object (normal-theory, asymptotically distribution-free, or heteroskedasticity-consistent). Two or more regressors are required.

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}.

For an effect size g(θ∗)g\left( \boldsymbol{\theta}^{\ast} \right) that is a function of the standardized parameters, the sampling variance is approximated by the delta method,

var⁡^(g^)=Jg Σ^θ∗ Jg′,\widehat{\operatorname{var}} \left( \hat{g} \right) = \boldsymbol{J}_{g} \, \widehat{\boldsymbol{\Sigma}}_{\boldsymbol{\theta}^{\ast}} \, \boldsymbol{J}_{g}^{\prime},

where Jg\boldsymbol{J}_{g} is the Jacobian of gg and Σ^θ∗\widehat{\boldsymbol{\Sigma}}_{\boldsymbol{\theta}^{\ast}} is the sampling covariance matrix from BetaHC(), BetaADF(), or BetaN().

Value

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

call

Function call.

fit

The argument object.

args

Function arguments.

vcov

Sampling covariance matrix of improvement in R-squared (squared semipartial correlation coefficients).

est

Vector of improvement in R-squared (squared semipartial correlation coefficients).

fun

Function used ("DeltaRSqSandwich").

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 Sandwich Functions: BetaADF(), BetaHC(), BetaN(), DiffBetaSandwich(), FSqSandwich(), PCorSandwich(), RSqSandwich(), SCorSandwich(), SCorSqSandwich()

Examples

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

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

# BetaHC -------------------------------------------------------------------
std <- BetaHC(object = object)

# DeltaRSqSandwich ---------------------------------------------------------
out <- DeltaRSqSandwich(object = std)

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

Estimate Differences of Standardized Regression Coefficients and the Corresponding Sampling Covariance Matrix

Description

Estimate Differences of Standardized Regression Coefficients and the Corresponding Sampling Covariance Matrix

Usage

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

Arguments

object

Object of class betasandwich, that is, the output of the BetaHC(), BetaN(), or BetaADF() functions.

alpha

Numeric vector. Significance level α\alpha.

Details

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

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

Collect the differences as Cβ∗\boldsymbol{C} \boldsymbol{\beta}^{\ast}, where each row of C\boldsymbol{C} has 11 in column jj, −1-1 in column ll, and zeros elsewhere. The sampling covariance matrix is

var⁡^(Cβ^∗)=Cvar⁡^(β^∗)C′,\widehat{\operatorname{var}} \left( \boldsymbol{C} \hat{\boldsymbol{\beta}}^{\ast} \right) = \boldsymbol{C} \widehat{\operatorname{var}} \left( \hat{\boldsymbol{\beta}}^{\ast} \right) \boldsymbol{C}^{\prime},

with var⁡^(β^∗)\widehat{\operatorname{var}} \left( \hat{\boldsymbol{\beta}}^{\ast} \right) from BetaHC(), BetaN(), or BetaADF(), and the confidence intervals are Δβ^jl∗±z1−α/2se⁡^(Δβ^jl∗)\Delta \hat{\beta}^{\ast}_{jl} \pm z_{1 - \alpha / 2} \widehat{\operatorname{se}} \left( \Delta \hat{\beta}^{\ast}_{jl} \right).

Value

Returns an object of class essandwich (and diffbetasandwich) which is a list with the following elements:

call

Function call.

fit

The argument object.

args

Function arguments.

vcov

Sampling covariance matrix of differences of standardized slopes.

est

Vector of differences of standardized slopes.

fun

Function used ("DiffBetaSandwich").

Author(s)

Ivan Jacob Agaloos Pesigan

See Also

Other Beta Sandwich Functions: BetaADF(), BetaHC(), BetaN(), DeltaRSqSandwich(), FSqSandwich(), PCorSandwich(), RSqSandwich(), SCorSandwich(), SCorSqSandwich()

Examples

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

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

# BetaHC -------------------------------------------------------------------
std <- BetaHC(object = object)

# DiffBetaSandwich ---------------------------------------------------------
diff <- DiffBetaSandwich(object = std)

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

Estimate Cohen's f-Squared and Local f-Squared and the Corresponding Sampling Covariance Matrix

Description

Estimate Cohen's f-Squared and Local f-Squared and the Corresponding Sampling Covariance Matrix

Usage

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

Arguments

object

Object of class betasandwich, that is, the output of the BetaHC(), BetaN(), or BetaADF() functions.

alpha

Numeric vector. Significance level α\alpha.

Details

The sampling covariance matrix is obtained by the delta method from the sampling covariance matrix of the standardized parameters stored in object (normal-theory, asymptotically distribution-free, or heteroskedasticity-consistent).

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. For an effect size g(θ∗)g\left( \boldsymbol{\theta}^{\ast} \right) that is a function of the standardized parameters, the sampling variance is approximated by the delta method,

var⁡^(g^)=Jg Σ^θ∗ Jg′,\widehat{\operatorname{var}} \left( \hat{g} \right) = \boldsymbol{J}_{g} \, \widehat{\boldsymbol{\Sigma}}_{\boldsymbol{\theta}^{\ast}} \, \boldsymbol{J}_{g}^{\prime},

where Jg\boldsymbol{J}_{g} is the Jacobian of gg and Σ^θ∗\widehat{\boldsymbol{\Sigma}}_{\boldsymbol{\theta}^{\ast}} is the sampling covariance matrix from BetaHC(), BetaADF(), or BetaN().

Value

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

call

Function call.

fit

The argument object.

args

Function arguments.

vcov

Sampling covariance matrix of Cohen's f-squared (fsq) and the local f-squared of each regressor.

est

Vector of Cohen's f-squared (fsq) and the local f-squared of each regressor.

fun

Function used ("FSqSandwich").

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 Sandwich Functions: BetaADF(), BetaHC(), BetaN(), DeltaRSqSandwich(), DiffBetaSandwich(), PCorSandwich(), RSqSandwich(), SCorSandwich(), SCorSqSandwich()

Examples

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

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

# BetaHC -------------------------------------------------------------------
std <- BetaHC(object = object)

# FSqSandwich --------------------------------------------------------------
out <- FSqSandwich(object = std)

## 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.


Estimate Squared Partial Correlation Coefficients and the Corresponding Sampling Covariance Matrix

Description

Estimate Squared Partial Correlation Coefficients and the Corresponding Sampling Covariance Matrix

Usage

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

Arguments

object

Object of class betasandwich, that is, the output of the BetaHC(), BetaN(), or BetaADF() functions.

alpha

Numeric vector. Significance level α\alpha.

Details

The sampling covariance matrix is obtained by the delta method from the sampling covariance matrix of the standardized parameters stored in object (normal-theory, asymptotically distribution-free, or heteroskedasticity-consistent). Two or more regressors are required.

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. For an effect size g(θ∗)g\left( \boldsymbol{\theta}^{\ast} \right) that is a function of the standardized parameters, the sampling variance is approximated by the delta method,

var⁡^(g^)=Jg Σ^θ∗ Jg′,\widehat{\operatorname{var}} \left( \hat{g} \right) = \boldsymbol{J}_{g} \, \widehat{\boldsymbol{\Sigma}}_{\boldsymbol{\theta}^{\ast}} \, \boldsymbol{J}_{g}^{\prime},

where Jg\boldsymbol{J}_{g} is the Jacobian of gg and Σ^θ∗\widehat{\boldsymbol{\Sigma}}_{\boldsymbol{\theta}^{\ast}} is the sampling covariance matrix from BetaHC(), BetaADF(), or BetaN().

Value

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

call

Function call.

fit

The argument object.

args

Function arguments.

vcov

Sampling covariance matrix of squared partial correlation coefficients.

est

Vector of squared partial correlation coefficients.

fun

Function used ("PCorSandwich").

Author(s)

Ivan Jacob Agaloos Pesigan

See Also

Other Beta Sandwich Functions: BetaADF(), BetaHC(), BetaN(), DeltaRSqSandwich(), DiffBetaSandwich(), FSqSandwich(), RSqSandwich(), SCorSandwich(), SCorSqSandwich()

Examples

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

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

# BetaHC -------------------------------------------------------------------
std <- BetaHC(object = object)

# PCorSandwich -------------------------------------------------------------
out <- PCorSandwich(object = std)

## 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 betasandwich

Description

Print Method for an Object of Class betasandwich

Usage

## S3 method for class 'betasandwich'
print(x, alpha = NULL, digits = 4, ...)

Arguments

x

Object of class betasandwich.

alpha

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

digits

Digits to print.

...

additional arguments.

Value

Prints a matrix of standardized regression slopes, standard errors, test statistics, degrees of freedom, p-values, and confidence intervals.

Author(s)

Ivan Jacob Agaloos Pesigan

Examples

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

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

# BetaHC -------------------------------------------------------------------
std <- BetaHC(object = object)

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

Print Method for an Object of Class essandwich

Description

Print Method for an Object of Class essandwich

Usage

## S3 method for class 'essandwich'
print(x, alpha = NULL, digits = 4, ...)

Arguments

x

Object of class essandwich.

alpha

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

digits

Digits to print.

...

additional arguments.

Value

Prints a matrix of estimates, standard errors, test statistics, p-values, and confidence intervals.

Author(s)

Ivan Jacob Agaloos Pesigan

Examples

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

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

# BetaHC -------------------------------------------------------------------
std <- BetaHC(object = object)

# RSqSandwich --------------------------------------------------------------
out <- RSqSandwich(object = std)

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

Print Method for an Object of Class summary.essandwich

Description

Print Method for an Object of Class summary.essandwich

Usage

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

Arguments

x

Object of class summary.essandwich.

...

additional arguments.

Value

Prints a matrix of estimates, standard errors, test statistics, p-values, and confidence intervals.

Author(s)

Ivan Jacob Agaloos Pesigan

Examples

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

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

# BetaHC -------------------------------------------------------------------
std <- BetaHC(object = object)

# RSqSandwich --------------------------------------------------------------
out <- RSqSandwich(object = std)

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

Estimate R-Squared and Adjusted R-Squared and the Corresponding Sampling Covariance Matrix

Description

Estimate R-Squared and Adjusted R-Squared and the Corresponding Sampling Covariance Matrix

Usage

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

Arguments

object

Object of class betasandwich, that is, the output of the BetaHC(), BetaN(), or BetaADF() functions.

alpha

Numeric vector. Significance level α\alpha.

Details

The sampling covariance matrix is obtained by the delta method from the sampling covariance matrix of the standardized parameters stored in object (normal-theory, asymptotically distribution-free, or heteroskedasticity-consistent).

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. For an effect size g(θ∗)g\left( \boldsymbol{\theta}^{\ast} \right) that is a function of the standardized parameters, the sampling variance is approximated by the delta method,

var⁡^(g^)=Jg Σ^θ∗ Jg′,\widehat{\operatorname{var}} \left( \hat{g} \right) = \boldsymbol{J}_{g} \, \widehat{\boldsymbol{\Sigma}}_{\boldsymbol{\theta}^{\ast}} \, \boldsymbol{J}_{g}^{\prime},

where Jg\boldsymbol{J}_{g} is the Jacobian of gg and Σ^θ∗\widehat{\boldsymbol{\Sigma}}_{\boldsymbol{\theta}^{\ast}} is the sampling covariance matrix from BetaHC(), BetaADF(), or BetaN().

Value

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

call

Function call.

fit

The argument object.

args

Function arguments.

vcov

Sampling covariance matrix of R-squared and adjusted R-squared.

est

Vector of R-squared and adjusted R-squared.

fun

Function used ("RSqSandwich").

Author(s)

Ivan Jacob Agaloos Pesigan

See Also

Other Beta Sandwich Functions: BetaADF(), BetaHC(), BetaN(), DeltaRSqSandwich(), DiffBetaSandwich(), FSqSandwich(), PCorSandwich(), SCorSandwich(), SCorSqSandwich()

Examples

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

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

# BetaHC -------------------------------------------------------------------
std <- BetaHC(object = object)

# RSqSandwich --------------------------------------------------------------
out <- RSqSandwich(object = std)

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

Estimate Semipartial Correlation Coefficients and the Corresponding Sampling Covariance Matrix

Description

Estimate Semipartial Correlation Coefficients and the Corresponding Sampling Covariance Matrix

Usage

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

Arguments

object

Object of class betasandwich, that is, the output of the BetaHC(), BetaN(), or BetaADF() functions.

alpha

Numeric vector. Significance level α\alpha.

Details

The sampling covariance matrix is obtained by the delta method from the sampling covariance matrix of the standardized parameters stored in object (normal-theory, asymptotically distribution-free, or heteroskedasticity-consistent). Two or more regressors are required.

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}. For an effect size g(θ∗)g\left( \boldsymbol{\theta}^{\ast} \right) that is a function of the standardized parameters, the sampling variance is approximated by the delta method,

var⁡^(g^)=Jg Σ^θ∗ Jg′,\widehat{\operatorname{var}} \left( \hat{g} \right) = \boldsymbol{J}_{g} \, \widehat{\boldsymbol{\Sigma}}_{\boldsymbol{\theta}^{\ast}} \, \boldsymbol{J}_{g}^{\prime},

where Jg\boldsymbol{J}_{g} is the Jacobian of gg and Σ^θ∗\widehat{\boldsymbol{\Sigma}}_{\boldsymbol{\theta}^{\ast}} is the sampling covariance matrix from BetaHC(), BetaADF(), or BetaN().

Value

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

call

Function call.

fit

The argument object.

args

Function arguments.

vcov

Sampling covariance matrix of semipartial correlation coefficients.

est

Vector of semipartial correlation coefficients.

fun

Function used ("SCorSandwich").

Author(s)

Ivan Jacob Agaloos Pesigan

See Also

Other Beta Sandwich Functions: BetaADF(), BetaHC(), BetaN(), DeltaRSqSandwich(), DiffBetaSandwich(), FSqSandwich(), PCorSandwich(), RSqSandwich(), SCorSqSandwich()

Examples

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

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

# BetaHC -------------------------------------------------------------------
std <- BetaHC(object = object)

# SCorSandwich -------------------------------------------------------------
out <- SCorSandwich(object = std)

## 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

SCorSqSandwich(object, level = 0.95)

Arguments

object

Context accepted by SCorSandwich().

level

Single confidence level in (0, 1).

Details

The semipartial correlation srjsr_{j} (see SCorSandwich()) 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 DeltaRSqSandwich(), which is based on the delta method.

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 Sandwich Functions: BetaADF(), BetaHC(), BetaN(), DeltaRSqSandwich(), DiffBetaSandwich(), FSqSandwich(), PCorSandwich(), RSqSandwich(), SCorSandwich()

Examples

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

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

# BetaHC -------------------------------------------------------------------
std <- BetaHC(object = object)

# SCorSqSandwich -----------------------------------------------------------
SCorSqSandwich(object = std)

Summary Method for an Object of Class betasandwich

Description

Summary Method for an Object of Class betasandwich

Usage

## S3 method for class 'betasandwich'
summary(object, alpha = NULL, digits = 4, ...)

Arguments

object

Object of class betasandwich.

alpha

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

digits

Digits to print.

...

additional arguments.

Details

The confidence intervals are θ^±t1−α/2,n−kse⁡^(θ^)\hat{\theta} \pm t_{1 - \alpha / 2, n - k} \widehat{\operatorname{se}} \left( \hat{\theta} \right), where se⁡^\widehat{\operatorname{se}} is the square root of the diagonal of the sampling covariance matrix (see BetaHC(), BetaN(), and BetaADF()), nn is the sample size, and kk is the number of regression parameters, including the intercept. The test statistic is θ^/se⁡^(θ^)\hat{\theta} / \widehat{\operatorname{se}} \left( \hat{\theta} \right) with n−kn - k degrees of freedom.

Value

Returns a matrix of standardized regression slopes, standard errors, test statistics, degrees of freedom, p-values, and confidence intervals.

Author(s)

Ivan Jacob Agaloos Pesigan

Examples

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

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

# BetaHC -------------------------------------------------------------------
std <- BetaHC(object = object)

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

Summary Method for an Object of Class essandwich

Description

Summary Method for an Object of Class essandwich

Usage

## S3 method for class 'essandwich'
summary(object, alpha = NULL, digits = 4, ...)

Arguments

object

Object of class essandwich.

alpha

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

digits

Digits to print.

...

additional arguments.

Details

The confidence intervals are θ^±z1−α/2se⁡^(θ^)\hat{\theta} \pm z_{1 - \alpha / 2} \widehat{\operatorname{se}} \left( \hat{\theta} \right), where se⁡^\widehat{\operatorname{se}} is the square root of the diagonal of the delta-method sampling covariance matrix of the effect size, and zpz_{p} is the pp quantile of the standard normal distribution. The test statistic is z=θ^/se⁡^(θ^)z = \hat{\theta} / \widehat{\operatorname{se}} \left( \hat{\theta} \right).

Value

Returns a matrix of estimates, standard errors, test statistics, p-values, and confidence intervals.

Author(s)

Ivan Jacob Agaloos Pesigan

Examples

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

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

# BetaHC -------------------------------------------------------------------
std <- BetaHC(object = object)

# RSqSandwich --------------------------------------------------------------
out <- RSqSandwich(object = std)

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

Sampling Covariance Matrix of the Standardized Regression Slopes

Description

Sampling Covariance Matrix of the Standardized Regression Slopes

Usage

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

Arguments

object

Object of class betasandwich.

...

additional arguments.

Value

Returns a matrix of the variance-covariance matrix of standardized slopes.

Author(s)

Ivan Jacob Agaloos Pesigan

Examples

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

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

# BetaHC -------------------------------------------------------------------
std <- BetaHC(object = object)

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

Sampling Covariance Matrix for an Object of Class essandwich

Description

Sampling Covariance Matrix for an Object of Class essandwich

Usage

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

Arguments

object

Object of class essandwich.

...

additional arguments.

Value

Returns a matrix of the variance-covariance matrix of the estimates.

Author(s)

Ivan Jacob Agaloos Pesigan

Examples

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

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

# BetaHC -------------------------------------------------------------------
std <- BetaHC(object = object)

# RSqSandwich --------------------------------------------------------------
out <- RSqSandwich(object = std)

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