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>. The package can also be used to generate confidence intervals for R-squared, adjusted R-squared, and differences of standardized regression coefficients. 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] |
Maintainer: | Ivan Jacob Agaloos Pesigan <[email protected]> |
License: | MIT + file LICENSE |
Version: | 1.0.7.9000 |
Built: | 2024-11-21 05:51:12 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))
BetaADF(object, alpha = c(0.05, 0.01, 0.001))
object |
Object of class |
alpha |
Numeric vector.
Significance level |
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.
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()
,
DiffBetaSandwich()
,
RSqBetaSandwich()
object <- lm(QUALITY ~ NARTIC + PCTGRT + PCTSUPP, data = nas1982) std <- BetaADF(object) # Methods ------------------------------------------------------- print(std) summary(std) coef(std) vcov(std) confint(std, level = 0.95)
object <- lm(QUALITY ~ NARTIC + PCTGRT + PCTSUPP, data = nas1982) std <- BetaADF(object) # Methods ------------------------------------------------------- print(std) summary(std) coef(std) vcov(std) confint(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), g1 = 1, g2 = 1.5, k = 0.7 )
BetaHC( object, type = "hc3", alpha = c(0.05, 0.01, 0.001), 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 |
g1 |
Numeric.
|
g2 |
Numeric.
|
k |
Numeric.
Constant |
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()
,
DiffBetaSandwich()
,
RSqBetaSandwich()
object <- lm(QUALITY ~ NARTIC + PCTGRT + PCTSUPP, data = nas1982) std <- BetaHC(object) # Methods ------------------------------------------------------- print(std) summary(std) coef(std) vcov(std) confint(std, level = 0.95)
object <- lm(QUALITY ~ NARTIC + PCTGRT + PCTSUPP, data = nas1982) std <- BetaHC(object) # Methods ------------------------------------------------------- print(std) summary(std) coef(std) vcov(std) confint(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))
BetaN(object, alpha = c(0.05, 0.01, 0.001))
object |
Object of class |
alpha |
Numeric vector.
Significance level |
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.
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()
,
DiffBetaSandwich()
,
RSqBetaSandwich()
object <- lm(QUALITY ~ NARTIC + PCTGRT + PCTSUPP, data = nas1982) std <- BetaN(object) # Methods ------------------------------------------------------- print(std) summary(std) coef(std) vcov(std) confint(std, level = 0.95)
object <- lm(QUALITY ~ NARTIC + PCTGRT + PCTSUPP, data = nas1982) std <- BetaN(object) # Methods ------------------------------------------------------- print(std) summary(std) coef(std) vcov(std) confint(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
object <- lm(QUALITY ~ NARTIC + PCTGRT + PCTSUPP, data = nas1982) std <- BetaHC(object) coef(std)
object <- lm(QUALITY ~ NARTIC + PCTGRT + PCTSUPP, data = nas1982) std <- BetaHC(object) coef(std)
Differences of Standardized Regression Slopes
## S3 method for class 'diffbetasandwich' coef(object, ...)
## S3 method for class 'diffbetasandwich' coef(object, ...)
object |
Object of class |
... |
additional arguments. |
Returns a vector of differences of standardized regression slopes.
Ivan Jacob Agaloos Pesigan
object <- lm(QUALITY ~ NARTIC + PCTGRT + PCTSUPP, data = nas1982) std <- BetaHC(object) diff <- DiffBetaSandwich(std) coef(diff)
object <- lm(QUALITY ~ NARTIC + PCTGRT + PCTSUPP, data = nas1982) std <- BetaHC(object) diff <- DiffBetaSandwich(std) coef(diff)
Multiple Correlation Coefficients (R-Squared and Adjusted R-Squared)
## S3 method for class 'rsqbetasandwich' coef(object, ...)
## S3 method for class 'rsqbetasandwich' coef(object, ...)
object |
Object of class |
... |
additional arguments. |
Returns a vector of multiple correlation coefficients (R-squared and adjusted R-squared)
Ivan Jacob Agaloos Pesigan
object <- lm(QUALITY ~ NARTIC + PCTGRT + PCTSUPP, data = nas1982) std <- BetaHC(object) rsq <- RSqBetaSandwich(std) coef(rsq)
object <- lm(QUALITY ~ NARTIC + PCTGRT + PCTSUPP, data = nas1982) std <- BetaHC(object) rsq <- RSqBetaSandwich(std) coef(rsq)
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. |
Returns a matrix of confidence intervals.
Ivan Jacob Agaloos Pesigan
object <- lm(QUALITY ~ NARTIC + PCTGRT + PCTSUPP, data = nas1982) std <- BetaHC(object) confint(std, level = 0.95)
object <- lm(QUALITY ~ NARTIC + PCTGRT + PCTSUPP, data = nas1982) std <- BetaHC(object) confint(std, level = 0.95)
Confidence Intervals for Differences of Standardized Regression Slopes
## S3 method for class 'diffbetasandwich' confint(object, parm = NULL, level = 0.95, ...)
## S3 method for class 'diffbetasandwich' 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. |
Returns a matrix of confidence intervals.
Ivan Jacob Agaloos Pesigan
object <- lm(QUALITY ~ NARTIC + PCTGRT + PCTSUPP, data = nas1982) std <- BetaHC(object) diff <- DiffBetaSandwich(std) confint(diff, level = 0.95)
object <- lm(QUALITY ~ NARTIC + PCTGRT + PCTSUPP, data = nas1982) std <- BetaHC(object) diff <- DiffBetaSandwich(std) confint(diff, level = 0.95)
Confidence Intervals for Multiple Correlation Coefficients (R-Squared and Adjusted R-Squared)
## S3 method for class 'rsqbetasandwich' confint(object, parm = NULL, level = 0.95, ...)
## S3 method for class 'rsqbetasandwich' 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. |
Returns a matrix of confidence intervals.
Ivan Jacob Agaloos Pesigan
object <- lm(QUALITY ~ NARTIC + PCTGRT + PCTSUPP, data = nas1982) std <- BetaHC(object) rsq <- RSqBetaSandwich(std) confint(rsq, level = 0.95)
object <- lm(QUALITY ~ NARTIC + PCTGRT + PCTSUPP, data = nas1982) std <- BetaHC(object) rsq <- RSqBetaSandwich(std) confint(rsq, level = 0.95)
Estimate Differences of Standardized Slopes 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 |
Returns an object of class 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.
Ivan Jacob Agaloos Pesigan
Other Beta Sandwich Functions:
BetaADF()
,
BetaHC()
,
BetaN()
,
RSqBetaSandwich()
object <- lm(QUALITY ~ NARTIC + PCTGRT + PCTSUPP, data = nas1982) std <- BetaHC(object) diff <- DiffBetaSandwich(std) # Methods ------------------------------------------------------- print(diff) summary(diff) coef(diff) vcov(diff) confint(diff, level = 0.95)
object <- lm(QUALITY ~ NARTIC + PCTGRT + PCTSUPP, data = nas1982) std <- BetaHC(object) diff <- DiffBetaSandwich(std) # Methods ------------------------------------------------------- print(diff) summary(diff) coef(diff) vcov(diff) confint(diff, level = 0.95)
1982 National Academy of Sciences Doctoral Programs Data
nas1982
nas1982
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.
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
object <- lm(QUALITY ~ NARTIC + PCTGRT + PCTSUPP, data = nas1982) std <- BetaHC(object) print(std)
object <- lm(QUALITY ~ NARTIC + PCTGRT + PCTSUPP, data = nas1982) std <- BetaHC(object) print(std)
diffbetasandwich
Print Method for an Object of Class diffbetasandwich
## S3 method for class 'diffbetasandwich' print(x, alpha = NULL, digits = 4, ...)
## S3 method for class 'diffbetasandwich' 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 differences of standardized regression slopes, standard errors, test statistics, degrees of freedom, p-values, and confidence intervals.
Ivan Jacob Agaloos Pesigan
object <- lm(QUALITY ~ NARTIC + PCTGRT + PCTSUPP, data = nas1982) std <- BetaHC(object) diff <- DiffBetaSandwich(std) print(diff)
object <- lm(QUALITY ~ NARTIC + PCTGRT + PCTSUPP, data = nas1982) std <- BetaHC(object) diff <- DiffBetaSandwich(std) print(diff)
rsqbetasandwich
Print Method for an Object of Class rsqbetasandwich
## S3 method for class 'rsqbetasandwich' print(x, alpha = NULL, digits = 4, ...)
## S3 method for class 'rsqbetasandwich' 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 multiple correlation coefficients (R-squared and adjusted R-squared), standard errors, test statistics, degrees of freedom, p-values, and confidence intervals.
Ivan Jacob Agaloos Pesigan
object <- lm(QUALITY ~ NARTIC + PCTGRT + PCTSUPP, data = nas1982) std <- BetaHC(object) rsq <- RSqBetaSandwich(std) print(rsq)
object <- lm(QUALITY ~ NARTIC + PCTGRT + PCTSUPP, data = nas1982) std <- BetaHC(object) rsq <- RSqBetaSandwich(std) print(rsq)
Estimate Multiple Correlation Coefficients (R-squared and adjusted R-squared) and the Corresponding Sampling Covariance Matrix
RSqBetaSandwich(object, alpha = c(0.05, 0.01, 0.001))
RSqBetaSandwich(object, alpha = c(0.05, 0.01, 0.001))
object |
Object of class |
alpha |
Numeric vector.
Significance level |
Returns an object of class rsqbetasandwich
which is a list with the following elements:
Function call.
The argument object
.
Function arguments.
Sampling covariance matrix of multiple correlation coefficients (R-squared and adjusted R-squared).
Vector of multiple correlation coefficients (R-squared and adjusted R-squared).
Ivan Jacob Agaloos Pesigan
Other Beta Sandwich Functions:
BetaADF()
,
BetaHC()
,
BetaN()
,
DiffBetaSandwich()
object <- lm(QUALITY ~ NARTIC + PCTGRT + PCTSUPP, data = nas1982) std <- BetaHC(object) rsq <- RSqBetaSandwich(std) # Methods ------------------------------------------------------- print(rsq) summary(rsq) coef(rsq) vcov(rsq) confint(rsq, level = 0.95)
object <- lm(QUALITY ~ NARTIC + PCTGRT + PCTSUPP, data = nas1982) std <- BetaHC(object) rsq <- RSqBetaSandwich(std) # Methods ------------------------------------------------------- print(rsq) summary(rsq) coef(rsq) vcov(rsq) confint(rsq, level = 0.95)
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. |
Returns a matrix of standardized regression slopes, standard errors, test statistics, degrees of freedom, p-values, and confidence intervals.
Ivan Jacob Agaloos Pesigan
object <- lm(QUALITY ~ NARTIC + PCTGRT + PCTSUPP, data = nas1982) std <- BetaHC(object) summary(std)
object <- lm(QUALITY ~ NARTIC + PCTGRT + PCTSUPP, data = nas1982) std <- BetaHC(object) summary(std)
diffbetasandwich
Summary Method for an Object of Class diffbetasandwich
## S3 method for class 'diffbetasandwich' summary(object, alpha = NULL, digits = 4, ...)
## S3 method for class 'diffbetasandwich' summary(object, alpha = NULL, digits = 4, ...)
object |
Object of class |
alpha |
Numeric vector.
Significance level |
digits |
Digits to print. |
... |
additional arguments. |
Returns a matrix of differences of standardized regression slopes, standard errors, test statistics, degrees of freedom, p-values, and confidence intervals.
Ivan Jacob Agaloos Pesigan
object <- lm(QUALITY ~ NARTIC + PCTGRT + PCTSUPP, data = nas1982) std <- BetaHC(object) diff <- DiffBetaSandwich(std) summary(diff)
object <- lm(QUALITY ~ NARTIC + PCTGRT + PCTSUPP, data = nas1982) std <- BetaHC(object) diff <- DiffBetaSandwich(std) summary(diff)
rsqbetasandwich
Summary Method for an Object of Class rsqbetasandwich
## S3 method for class 'rsqbetasandwich' summary(object, alpha = NULL, digits = 4, ...)
## S3 method for class 'rsqbetasandwich' summary(object, alpha = NULL, digits = 4, ...)
object |
Object of class |
alpha |
Numeric vector.
Significance level |
digits |
Digits to print. |
... |
additional arguments. |
Returns a matrix of multiple correlation coefficients (R-squared and adjusted R-squared), standard errors, test statistics, degrees of freedom, p-values, and confidence intervals.
Ivan Jacob Agaloos Pesigan
object <- lm(QUALITY ~ NARTIC + PCTGRT + PCTSUPP, data = nas1982) std <- BetaHC(object) rsq <- RSqBetaSandwich(std) summary(rsq)
object <- lm(QUALITY ~ NARTIC + PCTGRT + PCTSUPP, data = nas1982) std <- BetaHC(object) rsq <- RSqBetaSandwich(std) summary(rsq)
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
object <- lm(QUALITY ~ NARTIC + PCTGRT + PCTSUPP, data = nas1982) std <- BetaHC(object) vcov(std)
object <- lm(QUALITY ~ NARTIC + PCTGRT + PCTSUPP, data = nas1982) std <- BetaHC(object) vcov(std)
Sampling Covariance Matrix of Differences of Standardized Regression Slopes
## S3 method for class 'diffbetasandwich' vcov(object, ...)
## S3 method for class 'diffbetasandwich' vcov(object, ...)
object |
Object of class |
... |
additional arguments. |
Returns a matrix of the variance-covariance matrix of differences of standardized regression slopes.
Ivan Jacob Agaloos Pesigan
object <- lm(QUALITY ~ NARTIC + PCTGRT + PCTSUPP, data = nas1982) std <- BetaHC(object) diff <- DiffBetaSandwich(std) vcov(diff)
object <- lm(QUALITY ~ NARTIC + PCTGRT + PCTSUPP, data = nas1982) std <- BetaHC(object) diff <- DiffBetaSandwich(std) vcov(diff)
Sampling Covariance Matrix of Multiple Correlation Coefficients (R-Squared and Adjusted R-Squared)
## S3 method for class 'rsqbetasandwich' vcov(object, ...)
## S3 method for class 'rsqbetasandwich' vcov(object, ...)
object |
Object of class |
... |
additional arguments. |
Returns a matrix of the variance-covariance matrix of multiple correlation coefficients (R-squared and adjusted R-squared).
Ivan Jacob Agaloos Pesigan
object <- lm(QUALITY ~ NARTIC + PCTGRT + PCTSUPP, data = nas1982) std <- BetaHC(object) rsq <- RSqBetaSandwich(std) vcov(rsq)
object <- lm(QUALITY ~ NARTIC + PCTGRT + PCTSUPP, data = nas1982) std <- BetaHC(object) rsq <- RSqBetaSandwich(std) vcov(rsq)