| 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 |
Estimate Standardized Regression Coefficients and the Corresponding Sampling Covariance Matrix Using the Asymptotic Distribution-Free Approach
BetaADF(object, alpha = c(0.05, 0.01, 0.001), std_y = TRUE, std_x = NULL)BetaADF(object, alpha = c(0.05, 0.01, 0.001), std_y = TRUE, std_x = NULL)
object |
Object of class |
alpha |
Numeric vector.
Significance level |
std_y |
Logical.
Standardize |
std_x |
Character vector or |
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
The regression slopes and the standardized regression slopes are
where is the standard deviation of regressor .
With std_y = FALSE, is replaced by one;
for a regressor left out of std_x, is replaced by one.
Let collect the standardized slopes,
, the standard deviations of the regressors,
and the correlations of the regressors,
and let
be the Jacobian of the implied covariance matrix,
evaluated at the estimates (Dudgeon, 2017).
The asymptotically distribution-free sampling covariance matrix is
where is the unbiased estimator
is the covariance matrix with divisor ,
is the normal-theory matrix
(see BetaN()) at , and
with the deviation of observation from the
sample means.
The block of the standardized slopes is returned.
The confidence intervals are
,
where is the number of regression parameters,
including the intercept.
Returns an object
of class betasandwich which is a list with the following elements:
Function call.
Function arguments.
Processed lm object.
Asymptotic covariance matrix of the sample covariance matrix assuming multivariate normality.
Asymptotic covariance matrix HC correction.
Asymptotic covariance matrix of the sample covariance matrix.
Asymptotic covariance matrix of the standardized slopes.
Sampling covariance matrix of the standardized slopes.
Vector of standardized slopes.
Ivan Jacob Agaloos Pesigan
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
Other Beta Sandwich Functions:
BetaHC(),
BetaN(),
DeltaRSqSandwich(),
DiffBetaSandwich(),
FSqSandwich(),
PCorSandwich(),
RSqSandwich(),
SCorSandwich(),
SCorSqSandwich()
# 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)# 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
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 )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 )
object |
Object of class |
type |
Character string.
Correction type.
Possible values are
|
alpha |
Numeric vector.
Significance level |
std_y |
Logical.
Standardize |
std_x |
Character vector or |
g1 |
Numeric.
|
g2 |
Numeric.
|
k |
Numeric.
Constant |
Partition the covariance matrix of the outcome and the regressors as
The regression slopes and the standardized regression slopes are
where is the standard deviation of regressor .
With std_y = FALSE, is replaced by one;
for a regressor left out of std_x, is replaced by one.
Let collect the standardized slopes,
, the standard deviations of the regressors,
and the correlations of the regressors,
and let
be the Jacobian of the implied covariance matrix,
evaluated at the estimates (Dudgeon, 2017).
The heteroskedasticity-consistent sampling covariance matrix is the
sandwich
where is the normal-theory
matrix (see BetaN()) and
with the deviation of observation from the
sample means.
The weight depends on the leverage ,
the number of regression parameters (including the intercept),
and type:
("hc0", "hc1"),
("hc2"),
("hc3"),
with
("hc4"),
with
("hc4m"),
and with
("hc5", where is the argument k).
With "hc1", the matrix is multiplied by .
The block of the standardized slopes is returned.
The confidence intervals are
,
where is the number of regression parameters,
including the intercept.
Returns an object
of class betasandwich which is a list with the following elements:
Function call.
Function arguments.
Processed lm object.
Asymptotic covariance matrix of the sample covariance matrix assuming multivariate normality.
Asymptotic covariance matrix HC correction.
Asymptotic covariance matrix of the sample covariance matrix.
Asymptotic covariance matrix of the standardized slopes.
Sampling covariance matrix of the standardized slopes.
Vector of standardized slopes.
Ivan Jacob Agaloos Pesigan
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
Other Beta Sandwich Functions:
BetaADF(),
BetaN(),
DeltaRSqSandwich(),
DiffBetaSandwich(),
FSqSandwich(),
PCorSandwich(),
RSqSandwich(),
SCorSandwich(),
SCorSqSandwich()
# 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)# 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
BetaN(object, alpha = c(0.05, 0.01, 0.001), std_y = TRUE, std_x = NULL)BetaN(object, alpha = c(0.05, 0.01, 0.001), std_y = TRUE, std_x = NULL)
object |
Object of class |
alpha |
Numeric vector.
Significance level |
std_y |
Logical.
Standardize |
std_x |
Character vector or |
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
The regression slopes and the standardized regression slopes are
where is the standard deviation of regressor .
With std_y = FALSE, is replaced by one;
for a regressor left out of std_x, is replaced by one.
Let collect the standardized slopes,
, the standard deviations of the regressors,
and the correlations of the regressors,
and let
be the Jacobian of the implied covariance matrix,
evaluated at the estimates (Dudgeon, 2017).
Under multivariate normality,
where is the sample covariance matrix and
is the Moore-Penrose inverse of the duplication
matrix.
The block of the standardized slopes is returned.
The confidence intervals are
,
where is the number of regression parameters,
including the intercept.
Returns an object
of class betasandwich which is a list with the following elements:
Function call.
Function arguments.
Processed lm object.
Asymptotic covariance matrix of the sample covariance matrix assuming multivariate normality.
Asymptotic covariance matrix HC correction.
Asymptotic covariance matrix of the sample covariance matrix.
Asymptotic covariance matrix of the standardized slopes.
Sampling covariance matrix of the standardized slopes.
Vector of standardized slopes.
Ivan Jacob Agaloos Pesigan
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
Other Beta Sandwich Functions:
BetaADF(),
BetaHC(),
DeltaRSqSandwich(),
DiffBetaSandwich(),
FSqSandwich(),
PCorSandwich(),
RSqSandwich(),
SCorSandwich(),
SCorSqSandwich()
# 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)# 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
## S3 method for class 'betasandwich' coef(object, ...)## S3 method for class 'betasandwich' coef(object, ...)
object |
Object of class |
... |
additional arguments. |
Returns a vector of standardized regression slopes.
Ivan Jacob Agaloos Pesigan
# 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)# 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)
essandwich
Estimates for an Object of Class essandwich
## S3 method for class 'essandwich' coef(object, ...)## S3 method for class 'essandwich' coef(object, ...)
object |
Object of class |
... |
additional arguments. |
Returns a vector of estimates.
Ivan Jacob Agaloos Pesigan
# 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)# 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
## S3 method for class 'betasandwich' confint(object, parm = NULL, level = 0.95, ...)## S3 method for class 'betasandwich' confint(object, parm = NULL, level = 0.95, ...)
object |
Object of class |
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. |
The confidence intervals are
,
where is the square root of the
diagonal of the sampling covariance matrix
(see BetaHC(), BetaN(), and BetaADF()),
is the sample size, and is the number of regression
parameters, including the intercept.
The test statistic is
with degrees of freedom.
Returns a matrix of confidence intervals.
Ivan Jacob Agaloos Pesigan
# 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)# 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)
essandwich
Confidence Intervals for an Object of Class essandwich
## S3 method for class 'essandwich' confint(object, parm = NULL, level = 0.95, ...)## S3 method for class 'essandwich' confint(object, parm = NULL, level = 0.95, ...)
object |
Object of class |
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. |
The confidence intervals are
,
where is the square root of the
diagonal of the delta-method sampling covariance matrix of the effect size,
and is the quantile of the standard normal
distribution.
The test statistic is
.
Returns a matrix of confidence intervals.
Ivan Jacob Agaloos Pesigan
# 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)# 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
DeltaRSqSandwich(object, alpha = c(0.05, 0.01, 0.001))DeltaRSqSandwich(object, alpha = c(0.05, 0.01, 0.001))
object |
Object of class |
alpha |
Numeric vector.
Significance level |
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 be the vector of standardized slopes,
the correlation matrix of the regressors,
the th diagonal element of ,
and .
The semipartial correlation of regressor is
where is the R-squared from regressing regressor
on the other regressors.
Its square, , is the change in when regressor
is added last.
Because , shrinks
toward zero
as regressor becomes more redundant with the other regressors.
The improvement in R-squared for regressor is
For an effect size
that is a function of the standardized parameters,
the sampling variance is approximated by the delta method,
where is the Jacobian of and
is the
sampling covariance matrix
from BetaHC(), BetaADF(), or BetaN().
Returns an object of class essandwich
which is a list with the following elements:
Function call.
The argument object.
Function arguments.
Sampling covariance matrix of improvement in R-squared (squared semipartial correlation coefficients).
Vector of improvement in R-squared (squared semipartial correlation coefficients).
Function used ("DeltaRSqSandwich").
Ivan Jacob Agaloos Pesigan
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
Other Beta Sandwich Functions:
BetaADF(),
BetaHC(),
BetaN(),
DiffBetaSandwich(),
FSqSandwich(),
PCorSandwich(),
RSqSandwich(),
SCorSandwich(),
SCorSqSandwich()
# 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)# 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
DiffBetaSandwich(object, alpha = c(0.05, 0.01, 0.001))DiffBetaSandwich(object, alpha = c(0.05, 0.01, 0.001))
object |
Object of class |
alpha |
Numeric vector.
Significance level |
For every pair of regressors ,
the difference of the standardized regression slopes is
Collect the differences as ,
where each row of has in column ,
in column , and zeros elsewhere.
The sampling covariance matrix is
with from BetaHC(), BetaN(), or
BetaADF(),
and the confidence intervals are
.
Returns an object of class essandwich
(and diffbetasandwich)
which is a list with the following elements:
Function call.
The argument object.
Function arguments.
Sampling covariance matrix of differences of standardized slopes.
Vector of differences of standardized slopes.
Function used ("DiffBetaSandwich").
Ivan Jacob Agaloos Pesigan
Other Beta Sandwich Functions:
BetaADF(),
BetaHC(),
BetaN(),
DeltaRSqSandwich(),
FSqSandwich(),
PCorSandwich(),
RSqSandwich(),
SCorSandwich(),
SCorSqSandwich()
# 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)# 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
FSqSandwich(object, alpha = c(0.05, 0.01, 0.001))FSqSandwich(object, alpha = c(0.05, 0.01, 0.001))
object |
Object of class |
alpha |
Numeric vector.
Significance level |
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 be the vector of standardized slopes,
the correlation matrix of the regressors,
the th diagonal element of ,
and .
The semipartial correlation of regressor is
where is the R-squared from regressing regressor
on the other regressors.
Its square, , is the change in when regressor
is added last.
Because , shrinks
toward zero
as regressor becomes more redundant with the other regressors.
Cohen's f-squared and the local f-squared of regressor are
By convention (Cohen, 1988), values of about 0.02, 0.15, and 0.35 are small,
medium, and large effects.
For an effect size
that is a function of the standardized parameters,
the sampling variance is approximated by the delta method,
where is the Jacobian of and
is the
sampling covariance matrix
from BetaHC(), BetaADF(), or BetaN().
Returns an object of class essandwich
which is a list with the following elements:
Function call.
The argument object.
Function arguments.
Sampling covariance matrix of Cohen's f-squared (fsq) and the local f-squared of each regressor.
Vector of Cohen's f-squared (fsq) and the local f-squared of each regressor.
Function used ("FSqSandwich").
Ivan Jacob Agaloos Pesigan
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
Other Beta Sandwich Functions:
BetaADF(),
BetaHC(),
BetaN(),
DeltaRSqSandwich(),
DiffBetaSandwich(),
PCorSandwich(),
RSqSandwich(),
SCorSandwich(),
SCorSqSandwich()
# 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)# 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
nas1982nas1982
Ratings of 46 doctoral programs in psychology in the USA with the following variables:
Program quality ratings.
Number of faculty members in the program.
Number of program graduates.
Percentage of program graduates who received support.
Percent of faculty members holding research grants.
Number of published articles attributed to program faculty member.
Percent of faculty with one or more published article.
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
PCorSandwich(object, alpha = c(0.05, 0.01, 0.001))PCorSandwich(object, alpha = c(0.05, 0.01, 0.001))
object |
Object of class |
alpha |
Numeric vector.
Significance level |
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 be the vector of standardized slopes,
the correlation matrix of the regressors,
the th diagonal element of ,
and .
The semipartial correlation of regressor is
where is the R-squared from regressing regressor
on the other regressors.
Its square, , is the change in when regressor
is added last.
Because , shrinks
toward zero
as regressor becomes more redundant with the other regressors.
The squared partial correlation is
the proportion of the variance in the outcome not explained by the other
regressors
that is explained by regressor .
For an effect size
that is a function of the standardized parameters,
the sampling variance is approximated by the delta method,
where is the Jacobian of and
is the
sampling covariance matrix
from BetaHC(), BetaADF(), or BetaN().
Returns an object of class essandwich
which is a list with the following elements:
Function call.
The argument object.
Function arguments.
Sampling covariance matrix of squared partial correlation coefficients.
Vector of squared partial correlation coefficients.
Function used ("PCorSandwich").
Ivan Jacob Agaloos Pesigan
Other Beta Sandwich Functions:
BetaADF(),
BetaHC(),
BetaN(),
DeltaRSqSandwich(),
DiffBetaSandwich(),
FSqSandwich(),
RSqSandwich(),
SCorSandwich(),
SCorSqSandwich()
# 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)# 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)
betasandwich
Print Method for an Object of Class betasandwich
## S3 method for class 'betasandwich' print(x, alpha = NULL, digits = 4, ...)## S3 method for class 'betasandwich' print(x, alpha = NULL, digits = 4, ...)
x |
Object of class |
alpha |
Numeric vector.
Significance level |
digits |
Digits to print. |
... |
additional arguments. |
Prints a matrix of standardized regression slopes, standard errors, test statistics, degrees of freedom, p-values, and confidence intervals.
Ivan Jacob Agaloos Pesigan
# 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)# 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)
essandwich
Print Method for an Object of Class essandwich
## S3 method for class 'essandwich' print(x, alpha = NULL, digits = 4, ...)## S3 method for class 'essandwich' print(x, alpha = NULL, digits = 4, ...)
x |
Object of class |
alpha |
Numeric vector.
Significance level |
digits |
Digits to print. |
... |
additional arguments. |
Prints a matrix of estimates, standard errors, test statistics, p-values, and confidence intervals.
Ivan Jacob Agaloos Pesigan
# 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)# 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.essandwich
Print Method for an Object of Class summary.essandwich
## S3 method for class 'summary.essandwich' print(x, ...)## S3 method for class 'summary.essandwich' print(x, ...)
x |
Object of class |
... |
additional arguments. |
Prints a matrix of estimates, standard errors, test statistics, p-values, and confidence intervals.
Ivan Jacob Agaloos Pesigan
# 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)# 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
RSqSandwich(object, alpha = c(0.05, 0.01, 0.001))RSqSandwich(object, alpha = c(0.05, 0.01, 0.001))
object |
Object of class |
alpha |
Numeric vector.
Significance level |
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 be the vector of standardized slopes,
the correlation matrix of the regressors,
the th diagonal element of ,
and .
The R-squared and the adjusted R-squared are
where is the sample size and is the number of parameters
in the regression model, including the intercept.
For an effect size
that is a function of the standardized parameters,
the sampling variance is approximated by the delta method,
where is the Jacobian of and
is the
sampling covariance matrix
from BetaHC(), BetaADF(), or BetaN().
Returns an object of class essandwich
which is a list with the following elements:
Function call.
The argument object.
Function arguments.
Sampling covariance matrix of R-squared and adjusted R-squared.
Vector of R-squared and adjusted R-squared.
Function used ("RSqSandwich").
Ivan Jacob Agaloos Pesigan
Other Beta Sandwich Functions:
BetaADF(),
BetaHC(),
BetaN(),
DeltaRSqSandwich(),
DiffBetaSandwich(),
FSqSandwich(),
PCorSandwich(),
SCorSandwich(),
SCorSqSandwich()
# 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)# 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
SCorSandwich(object, alpha = c(0.05, 0.01, 0.001))SCorSandwich(object, alpha = c(0.05, 0.01, 0.001))
object |
Object of class |
alpha |
Numeric vector.
Significance level |
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 be the vector of standardized slopes,
the correlation matrix of the regressors,
the th diagonal element of ,
and .
The semipartial correlation of regressor is
where is the R-squared from regressing regressor
on the other regressors.
Its square, , is the change in when regressor
is added last.
Because , shrinks
toward zero
as regressor becomes more redundant with the other regressors.
The sign of follows the sign of .
For an effect size
that is a function of the standardized parameters,
the sampling variance is approximated by the delta method,
where is the Jacobian of and
is the
sampling covariance matrix
from BetaHC(), BetaADF(), or BetaN().
Returns an object of class essandwich
which is a list with the following elements:
Function call.
The argument object.
Function arguments.
Sampling covariance matrix of semipartial correlation coefficients.
Vector of semipartial correlation coefficients.
Function used ("SCorSandwich").
Ivan Jacob Agaloos Pesigan
Other Beta Sandwich Functions:
BetaADF(),
BetaHC(),
BetaN(),
DeltaRSqSandwich(),
DiffBetaSandwich(),
FSqSandwich(),
PCorSandwich(),
RSqSandwich(),
SCorSqSandwich()
# 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)# 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)
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.
SCorSqSandwich(object, level = 0.95)SCorSqSandwich(object, level = 0.95)
object |
Context accepted by |
level |
Single confidence level in (0, 1). |
The semipartial correlation (see SCorSandwich()) is signed,
and its confidence interval may contain zero.
The interval for is the image of that interval under
squaring.
The squared interval is
if ,
if ,
and
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.
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.
Ivan Jacob Agaloos Pesigan
Other Beta Sandwich Functions:
BetaADF(),
BetaHC(),
BetaN(),
DeltaRSqSandwich(),
DiffBetaSandwich(),
FSqSandwich(),
PCorSandwich(),
RSqSandwich(),
SCorSandwich()
# 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)# 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)
betasandwich
Summary Method for an Object of Class betasandwich
## S3 method for class 'betasandwich' summary(object, alpha = NULL, digits = 4, ...)## S3 method for class 'betasandwich' summary(object, alpha = NULL, digits = 4, ...)
object |
Object of class |
alpha |
Numeric vector.
Significance level |
digits |
Digits to print. |
... |
additional arguments. |
The confidence intervals are
,
where is the square root of the
diagonal of the sampling covariance matrix
(see BetaHC(), BetaN(), and BetaADF()),
is the sample size, and is the number of regression
parameters, including the intercept.
The test statistic is
with degrees of freedom.
Returns a matrix of standardized regression slopes, standard errors, test statistics, degrees of freedom, p-values, and confidence intervals.
Ivan Jacob Agaloos Pesigan
# 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)# 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)
essandwich
Summary Method for an Object of Class essandwich
## S3 method for class 'essandwich' summary(object, alpha = NULL, digits = 4, ...)## S3 method for class 'essandwich' summary(object, alpha = NULL, digits = 4, ...)
object |
Object of class |
alpha |
Numeric vector.
Significance level |
digits |
Digits to print. |
... |
additional arguments. |
The confidence intervals are
,
where is the square root of the
diagonal of the delta-method sampling covariance matrix of the effect size,
and is the quantile of the standard normal
distribution.
The test statistic is
.
Returns a matrix of estimates, standard errors, test statistics, p-values, and confidence intervals.
Ivan Jacob Agaloos Pesigan
# 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)# 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
## S3 method for class 'betasandwich' vcov(object, ...)## S3 method for class 'betasandwich' vcov(object, ...)
object |
Object of class |
... |
additional arguments. |
Returns a matrix of the variance-covariance matrix of standardized slopes.
Ivan Jacob Agaloos Pesigan
# 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)# 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)
essandwich
Sampling Covariance Matrix for an Object of Class essandwich
## S3 method for class 'essandwich' vcov(object, ...)## S3 method for class 'essandwich' vcov(object, ...)
object |
Object of class |
... |
additional arguments. |
Returns a matrix of the variance-covariance matrix of the estimates.
Ivan Jacob Agaloos Pesigan
# 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)# 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)