-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Files changed: A .Rbuildignore A .github/linters/.lintr A .setup/build/betaDelta.pdf A .setup/build/betaDelta_1.0.2.9000.tar.gz A .setup/latex/bib/quarto.bib A .setup/lint/.lintr A CITATION.cff M DESCRIPTION A LICENSE A LICENSE.md A NAMESPACE A R/betaSandwich-jacobian-diff-beta-star-wrt-beta-star-dot.R A R/dataSets-nas1982.R A R/deltaMethod-acov-delta.R A R/gammaADF-gamma-adf-consistent-dot.R A R/gammaADF-gamma-adf-unbiased-dot.R A R/gammaN-gamma-mvn-dot.R A R/linearAlgebra-d-mat-dot.R A R/linearAlgebra-d-of-mat-dot.R A R/linearAlgebra-diag-of-vech-dot.R A R/linearAlgebra-pinv-of-d-mat-dot.R A R/linearAlgebra-vec-dot.R A R/linearAlgebra-vech-dot.R A R/linearAlgebra-vech-names-dot.R A R/processLM-dif-dot.R A R/processLM-process-lm-dot.R A R/rhoMatrix-rho-of-sigma-dot.R A R/strRegression-beta-star-of-rho-dot.R A R/strRegression-jacobian-beta-star-wrt-vech-sigma-dot.R A R/strRegression-moments-index-dot.R A R/strRegression-p-cor-sq-dot.R A R/strRegression-r-sq-bar-dot.R A R/strRegression-r-sq-of-sigma-dot.R A R/strRegression-s-p-cor-dot.R A R/wald-ci-wald-dot.R A R/wald-probs-of-alpha-dot.R A README.md M data/nas1982.rda A man/BetaDelta.Rd A man/DiffBetaDelta.Rd A man/betaDelta-package.Rd A man/coef.betadelta.Rd A man/coef.diffbetadelta.Rd A man/confint.betadelta.Rd A man/confint.diffbetadelta.Rd A man/nas1982.Rd A man/print.betadelta.Rd A man/print.diffbetadelta.Rd A man/summary.betadelta.Rd A man/summary.diffbetadelta.Rd A man/vcov.betadelta.Rd A man/vcov.diffbetadelta.Rd M project.Rproj A vignettes/example_beta_delta.Rmd A vignettes/example_diff_beta_delta.Rmd A vignettes/vignettes.bib
- Loading branch information
1 parent
aca5c9f
commit 42be71f
Showing
56 changed files
with
4,597 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
.*\.Rcheck$ | ||
.*\.Rproj$ | ||
^CITATION\.cff$ | ||
^LICENSE\.md$ | ||
^Makefile$ | ||
^README\.Rmd$ | ||
^README\.md$ | ||
^\.Rproj\.user$ | ||
^\.devcontainer$ | ||
^\.git.*$ | ||
^\.library$ | ||
^\.setup$ | ||
^\.sim$ | ||
^detritus$ | ||
^index\.qmd$ | ||
^pkgdown$ | ||
^quarto$ | ||
^scripts$ | ||
^vignettes$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
linters: lintr::linters_with_defaults(lintr::object_name_linter(styles = c("CamelCase", "snake_case", "symbols"))) | ||
exclusions: list("R/RcppExports.R") | ||
exclude: "# Exclude Linting" | ||
exclude_start: "# Begin Exclude Linting" | ||
exclude_end: "# End Exclude Linting" | ||
|
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
@Article{Craig-1936, | ||
author = {Cecil C. Craig}, | ||
date = {1936-03}, | ||
journaltitle = {The Annals of Mathematical Statistics}, | ||
title = {On the frequency function of $xy$}, | ||
doi = {10.1214/aoms/1177732541}, | ||
number = {1}, | ||
pages = {1--15}, | ||
volume = {7}, | ||
publisher = {Institute of Mathematical Statistics}, | ||
annotation = {mediation}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
linters: lintr::linters_with_defaults(lintr::object_name_linter(styles = c("CamelCase", "snake_case", "symbols"))) | ||
exclusions: list("R/RcppExports.R") | ||
exclude: "# Exclude Linting" | ||
exclude_start: "# Begin Exclude Linting" | ||
exclude_end: "# End Exclude Linting" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# ----------------------------------------------------------- | ||
# CITATION file created with {cffr} R package, v0.5.0 | ||
# See also: https://docs.ropensci.org/cffr/ | ||
# ----------------------------------------------------------- | ||
|
||
cff-version: 1.2.0 | ||
message: 'To cite package "betaDelta" in publications use:' | ||
type: software | ||
license: MIT | ||
title: 'betaDelta: Confidence Intervals for Standardized Regression Coefficients' | ||
version: 1.0.2.9000 | ||
doi: 10.1080/00273171.2023.2201277 | ||
abstract: Generates confidence intervals for standardized regression coefficients | ||
using delta method standard errors for models fitted by lm() as described in Yuan | ||
and Chan (2011) <doi:10.1007/s11336-011-9224-6> and Jones and Waller (2015) <doi:10.1007/s11336-013-9380-y>. | ||
A description of the package and code examples are presented in Pesigan, Sun, and | ||
Cheung (2023) <doi:10.1080/00273171.2023.2201277>. | ||
authors: | ||
- family-names: Pesigan | ||
given-names: Ivan Jacob Agaloos | ||
email: r.jeksterslab@gmail.com | ||
orcid: https://orcid.org/0000-0003-4818-8420 | ||
preferred-citation: | ||
type: article | ||
title: 'betaDelta and betaSandwich: Confidence intervals for standardized regression | ||
coefficients in R' | ||
authors: | ||
- family-names: Pesigan | ||
given-names: Ivan Jacob Agaloos | ||
email: r.jeksterslab@gmail.com | ||
orcid: https://orcid.org/0000-0003-4818-8420 | ||
- family-names: Sun | ||
given-names: Rongwei | ||
email: irissun_s@hotmail.com | ||
orcid: https://orcid.org/0000-0003-0034-1422 | ||
- family-names: Cheung | ||
given-names: Shu Fai | ||
email: shufai.cheung@gmail.com | ||
orcid: https://orcid.org/0000-0002-9871-9448 | ||
year: '2023' | ||
doi: 10.1080/00273171.2023.2201277 | ||
journal: Multivariate Behavioral Research | ||
notes: R package version 1.0.2.9000 | ||
repository: https://packagemanager.rstudio.com/all/__linux__/jammy/latest/ | ||
repository-code: https://github.com/jeksterslab/betaDelta | ||
url: https://jeksterslab.github.io/betaDelta/ | ||
contact: | ||
- family-names: Pesigan | ||
given-names: Ivan Jacob Agaloos | ||
email: r.jeksterslab@gmail.com | ||
orcid: https://orcid.org/0000-0003-4818-8420 | ||
keywords: | ||
- confidence-intervals | ||
- delta-method-standard-errors | ||
- r | ||
- r-package | ||
- standardized-regression-coefficients |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,3 +25,4 @@ Suggests: | |
rmarkdown, | ||
testthat, | ||
betaSandwich | ||
RoxygenNote: 7.2.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
YEAR: 2023 | ||
COPYRIGHT HOLDER: Ivan Jacob Agaloos Pesigan |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# MIT License | ||
|
||
Copyright (c) 2023 Ivan Jacob Agaloos Pesigan | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Generated by roxygen2: do not edit by hand | ||
|
||
S3method(coef,betadelta) | ||
S3method(coef,diffbetadelta) | ||
S3method(confint,betadelta) | ||
S3method(confint,diffbetadelta) | ||
S3method(print,betadelta) | ||
S3method(print,diffbetadelta) | ||
S3method(summary,betadelta) | ||
S3method(summary,diffbetadelta) | ||
S3method(vcov,betadelta) | ||
S3method(vcov,diffbetadelta) | ||
export(BetaDelta) | ||
export(DiffBetaDelta) |
26 changes: 26 additions & 0 deletions
26
R/betaSandwich-jacobian-diff-beta-star-wrt-beta-star-dot.R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#' Jacobian Matrix of Differences of Standardized Regression Slopes | ||
#' with Respect to the Standardized Regression Slopes | ||
#' | ||
#' @author Ivan Jacob Agaloos Pesigan | ||
#' | ||
#' @param p positive integer. | ||
#' Number of regressors. | ||
#' | ||
#' @family Beta Sandwich Functions | ||
#' @keywords betaSandwich derivatives internal | ||
#' @noRd | ||
.JacobianDiffBetaStar <- function(p) { | ||
idx <- utils::combn(seq_len(p), 2) | ||
q <- dim(idx)[2] | ||
out <- matrix( | ||
data = 0, | ||
nrow = q, | ||
ncol = p | ||
) | ||
for (i in seq_len(q)) { | ||
j <- idx[, i] | ||
out[i, j[1]] <- 1 | ||
out[i, j[2]] <- -1 | ||
} | ||
return(out) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#' 1982 National Academy of Sciences Doctoral Programs Data | ||
#' | ||
#' @format Ratings of 46 doctoral programs in psychology in the USA | ||
#' with the following variables: | ||
#' \describe{ | ||
#' \item{QUALITY}{Program quality ratings.} | ||
#' \item{NFACUL}{Number of faculty members in the program.} | ||
#' \item{NGRADS}{Number of program graduates.} | ||
#' \item{PCTSUPP}{Percentage of program graduates who received support.} | ||
#' \item{PCTGRT}{Percent of faculty members holding research grants.} | ||
#' \item{NARTIC}{Number of published articles | ||
#' attributed to program faculty member.} | ||
#' \item{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. | ||
#' @keywords data | ||
"nas1982" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#' Delta Method Asymptotic Covariance Matrix | ||
#' | ||
#' @author Ivan Jacob Agaloos Pesigan | ||
#' | ||
#' @param jcap Numeric matrix. | ||
#' Jacobian matrix. | ||
#' @param acov Numeric matrix. | ||
#' Asymptotic covariance matrix. | ||
#' @family Delta Method Functions | ||
#' @keywords deltaMethod acov internal | ||
#' @noRd | ||
.ACovDelta <- function(jcap, | ||
acov) { | ||
return( | ||
jcap %*% tcrossprod( | ||
acov, | ||
jcap | ||
) | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#' Asymptotic Covariance Matrix of the Sample Covariance Matrix | ||
#' (Asymptotic Distribution Free - Consistent) | ||
#' | ||
#' @author Ivan Jacob Agaloos Pesigan | ||
#' | ||
#' @param d Numeric matrix. | ||
#' Deviation scores. | ||
#' @param vechsigmacap_consistent Numeric vector. | ||
#' Half-vectorization of the consistent covariance matrix. | ||
#' @param n Integer. | ||
#' Sample size. | ||
#' | ||
#' @family gammaADF Functions | ||
#' @keywords gammaADF gamma internal | ||
#' @noRd | ||
.GammaADFConsistent <- function(d, | ||
vechsigmacap_consistent, | ||
n) { | ||
return( | ||
( | ||
(1 / n) * ( | ||
Reduce( | ||
f = `+`, | ||
x = lapply( | ||
X = 1:n, | ||
FUN = function(i, | ||
d) { | ||
tcrossprod( | ||
.Vech( | ||
tcrossprod(d[i, ]) | ||
) | ||
) | ||
}, | ||
d = d | ||
) | ||
) | ||
) | ||
) - tcrossprod( | ||
vechsigmacap_consistent | ||
) | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#' Asymptotic Covariance Matrix of the Sample Covariance Matrix | ||
#' (Asymptotic Distribution Free - Unbiased) | ||
#' | ||
#' @author Ivan Jacob Agaloos Pesigan | ||
#' | ||
#' @param gammacapadf_consistent Numeric matrix. | ||
#' Consistent estimate of the asymptotic distribution-free covariance matrix. | ||
#' @param gammacapmvn_consistent Numeric matrix. | ||
#' Asymptotic covariance matrix | ||
#' of the consistent estimator of the sample covariance | ||
#' assuming multivariate normal distribution. | ||
#' @param vechsigmacap_consistent Numeric vector. | ||
#' Half-vectorization of the consistent covariance matrix. | ||
#' @param n Integer. | ||
#' Sample size. | ||
#' | ||
#' @family gammaADF Functions | ||
#' @keywords gammaADF gamma internal | ||
#' @noRd | ||
.GammaADFUnbiased <- function(gammacapadf_consistent, | ||
gammacapmvn_consistent, | ||
vechsigmacap_consistent, | ||
n) { | ||
return( | ||
( | ||
( | ||
( | ||
n * (n - 1) | ||
) / ( | ||
(n - 2) * (n - 3) | ||
) | ||
) * gammacapadf_consistent | ||
) - ( | ||
( | ||
n / ( | ||
(n - 2) * (n - 3) | ||
) | ||
) * ( | ||
gammacapmvn_consistent - ( | ||
( | ||
2 / (n - 1) | ||
) * tcrossprod( | ||
vechsigmacap_consistent | ||
) | ||
) | ||
) | ||
) | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#' Asymptotic Covariance Matrix of the Sample Covariance Matrix | ||
#' (Multivariate Normal Distribution) | ||
#' | ||
#' @author Ivan Jacob Agaloos Pesigan | ||
#' | ||
#' @param sigmacap Numeric matrix. | ||
#' Covariance matrix. | ||
#' @param pinv_of_dcap Numeric matrix. | ||
#' Moore-Penrose inverse of the duplication matrix. | ||
#' | ||
#' @family gammaN Functions | ||
#' @keywords gammaN gamma internal | ||
#' @noRd | ||
.GammaN <- function(sigmacap, | ||
pinv_of_dcap) { | ||
return( | ||
2 * pinv_of_dcap %*% ( | ||
tcrossprod( | ||
kronecker( | ||
sigmacap, | ||
sigmacap | ||
), | ||
pinv_of_dcap | ||
) | ||
) | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#' The Duplication Matrix | ||
#' | ||
#' @author Ivan Jacob Agaloos Pesigan | ||
#' | ||
#' @param k Positive integer. | ||
#' Dimension of the `k` by `k` matrix. | ||
#' | ||
#' @return Returns a matrix. | ||
#' | ||
#' @family Symmetric Functions | ||
#' @keywords linearAlgebra symmetric internal | ||
#' @noRd | ||
.DMat <- function(k) { | ||
sym <- matrix( | ||
0, | ||
nrow = k, | ||
ncol = k | ||
) | ||
q <- seq_len( | ||
0.5 * k * (k + 1) | ||
) | ||
sym[lower.tri(sym, diag = TRUE)] <- q | ||
sym[upper.tri(sym)] <- t(sym)[upper.tri(sym)] | ||
return( | ||
outer( | ||
X = .Vec(sym), | ||
Y = q, | ||
FUN = function(x, y) { | ||
ifelse( | ||
test = x == y, | ||
yes = 1, | ||
no = 0 | ||
) | ||
} | ||
) | ||
) | ||
} |
Oops, something went wrong.