Skip to content

Commit

Permalink
Automated build.
Browse files Browse the repository at this point in the history
Files changed:
A	.Rbuildignore
A	.github/linters/.lintr
A	.setup/build/betaMC.pdf
A	.setup/build/betaMC_1.3.0.9000.tar.gz
A	.setup/data-raw/benchmark.Rds
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-acov-hc-dot.R
A	R/betaSandwich-acov-sem-inverse-dot.R
A	R/betaSandwich-cov-hc-dot.R
A	R/betaSandwich-gamma-hc-dot.R
A	R/betaSandwich-q-mat-dot.R
A	R/dataSets-nas1982.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-pinv-of-d-mat-dot.R
A	R/linearAlgebra-positive-definite-2-test-dot.R
A	R/linearAlgebra-positive-definite-test-dot.R
A	R/linearAlgebra-sym-of-vech-dot.R
A	R/linearAlgebra-vec-dot.R
A	R/linearAlgebra-vech-dot.R
A	R/linearAlgebra-vech-names-dot.R
A	R/miHelper-ariv-dot.R
A	R/miHelper-mi-combine-dot.R
A	R/miHelper-total-adj-dot.R
A	R/nBootstrap-ci-format-dot.R
A	R/nBootstrap-pc-ci-dot.R
A	R/nBootstrap-pc-probs-dot.R
A	R/processLM-dif-dot.R
A	R/processLM-process-lm-dot.R
A	R/randomGaussian-location-dot.R
A	R/randomGaussian-random-gaussian-chol-dot.R
A	R/randomGaussian-random-gaussian-eigen-dot.R
A	R/randomGaussian-random-gaussian-svd-dot.R
A	R/randomGaussian-random-gaussian-z-dot.R
A	R/rhoMatrix-rho-of-sigma-dot.R
A	R/semmcci-theta-hat-star-dot.R
A	R/strRegression-beta-star-dot.R
A	R/strRegression-beta-star-of-rho-dot.R
A	R/strRegression-jacobian-vech-sigma-wrt-theta-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/strRegression-sigma-y-sq-dot.R
A	R/strRegression-sigma-yx-dot.R
A	R/strRegression-theta-index-dot.R
A	README.md
M	data/nas1982.rda
A	man/BetaMC.Rd
A	man/DeltaRSqMC.Rd
A	man/DiffBetaMC.Rd
A	man/MC.Rd
A	man/MCMI.Rd
A	man/PCorMC.Rd
A	man/RSqMC.Rd
A	man/SCorMC.Rd
A	man/betaMC-package.Rd
A	man/coef.betamc.Rd
A	man/confint.betamc.Rd
A	man/nas1982.Rd
A	man/print.betamc.Rd
A	man/print.mc.Rd
A	man/summary.betamc.Rd
A	man/summary.mc.Rd
A	man/vcov.betamc.Rd
M	project.Rproj
A	vignettes/benchmark.Rmd
A	vignettes/fig-vignettes-benchmark-unnamed-chunk-15-1.png
A	vignettes/vignettes.bib
  • Loading branch information
jeksterslab committed Aug 29, 2023
1 parent 0f21ce4 commit 6e6a425
Show file tree
Hide file tree
Showing 79 changed files with 5,939 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .Rbuildignore
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$
6 changes: 6 additions & 0 deletions .github/linters/.lintr
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 added .setup/build/betaMC.pdf
Binary file not shown.
Binary file added .setup/build/betaMC_1.3.0.9000.tar.gz
Binary file not shown.
Binary file added .setup/data-raw/benchmark.Rds
Binary file not shown.
12 changes: 12 additions & 0 deletions .setup/latex/bib/quarto.bib
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},
}
6 changes: 6 additions & 0 deletions .setup/lint/.lintr
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"

56 changes: 56 additions & 0 deletions CITATION.cff
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# -----------------------------------------------------------
# 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 "betaMC" in publications use:'
type: software
license: MIT
title: 'betaMC: Monte Carlo for Regression Effect Sizes'
version: 1.3.0.9000
doi: 10.3758/s13428-023-02114-4
abstract: Generates Monte Carlo confidence intervals for standardized regression coefficients
(beta) and other effect sizes, including multiple correlation, semipartial correlations,
improvement in R-squared, squared partial correlations, and differences in standardized
regression coefficients, for models fitted by lm(). 'betaMC' combines ideas from
Monte Carlo confidence intervals for the indirect effect (Pesigan and Cheung, 2023
<doi:10.3758/s13428-023-02114-4>) and the sampling covariance matrix of regression
coefficients (Dudgeon, 2017 <doi:10.1007/s11336-017-9563-z>) to generate confidence
intervals effect sizes in regression.
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: Monte Carlo confidence intervals for the indirect effect with missing data
authors:
- family-names: Pesigan
given-names: Ivan Jacob Agaloos
email: r.jeksterslab@gmail.com
orcid: https://orcid.org/0000-0003-4818-8420
- family-names: Cheung
given-names: Shu Fai
email: shufai.cheung@gmail.com
orcid: https://orcid.org/0000-0002-9871-9448
year: '2023'
doi: 10.3758/s13428-023-02114-4
journal: Behavior Research Methods
notes: R package version 1.3.0.9000
repository: https://packagemanager.rstudio.com/all/__linux__/jammy/latest/
repository-code: https://github.com/jeksterslab/betaMC
url: https://jeksterslab.github.io/betaMC/
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
- monte-carlo
- r
- r-package
- regression-effect-sizes
- standardized-regression-coefficients
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@ Suggests:
MASS,
mice,
Amelia
RoxygenNote: 7.2.3
2 changes: 2 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
YEAR: 2023
COPYRIGHT HOLDER: Ivan Jacob Agaloos Pesigan
21 changes: 21 additions & 0 deletions LICENSE.md
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.
17 changes: 17 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by roxygen2: do not edit by hand

S3method(coef,betamc)
S3method(confint,betamc)
S3method(print,betamc)
S3method(print,mc)
S3method(summary,betamc)
S3method(summary,mc)
S3method(vcov,betamc)
export(BetaMC)
export(DeltaRSqMC)
export(DiffBetaMC)
export(MC)
export(MCMI)
export(PCorMC)
export(RSqMC)
export(SCorMC)
33 changes: 33 additions & 0 deletions R/betaSandwich-acov-hc-dot.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#' Asymptotic Covariance Matrix of the
#' Standardized Parameter Vector
#'
#' @author Ivan Jacob Agaloos Pesigan
#'
#' @param jcap Numeric matrix.
#' Jacobian matrix of the half-vectorization
#' of the model-implied covariance matrix
#' with respect to the standardized parameter vector.
#' @param gammacap Numeric matrix.
#' Adjusted asymptotic covariance matrix.
#' @param gammacap_mvn Numeric matrix.
#' Asymptotic covariance matrix of the sample covariance matrix
#' assuming multivariate normal distribution.
#'
#' @family Beta Sandwich Functions
#' @keywords betaSandwich acov internal
#' @noRd
.ACovHC <- function(jcap,
gammacap,
gammacap_mvn) {
inversemvn <- chol2inv(
chol(gammacap_mvn)
)
tjcapinversemvn <- t(jcap) %*% inversemvn
bread <- chol2inv(
chol(tjcapinversemvn %*% jcap)
)
meat <- tjcapinversemvn %*% gammacap %*% inversemvn %*% jcap
return(
bread %*% meat %*% bread
)
}
23 changes: 23 additions & 0 deletions R/betaSandwich-acov-sem-inverse-dot.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#' Inverse of The Asymptotic Covariance Matrix of the
#' Standardized Parameter Vector
#'
#' @author Ivan Jacob Agaloos Pesigan
#'
#' @param jcap Numeric matrix.
#' Jacobian matrix of the half-vectorization
#' of the model-implied covariance matrix
#' with respect to the standardized parameter vector.
#' @param acov Numeric matrix.
#' Asymptotic covariance matrix of the sample covariance matrix.
#'
#' @family Beta Sandwich Functions
#' @keywords betaSandwich acov internal
#' @noRd
.ACovSEMInverse <- function(jcap,
acov) {
return(
t(jcap) %*% chol2inv(
chol(acov)
) %*% jcap
)
}
37 changes: 37 additions & 0 deletions R/betaSandwich-cov-hc-dot.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#' Sampling Covariance Matrix of the Standardized Parameter Vector
#'
#' @author Ivan Jacob Agaloos Pesigan
#'
#' @param acov Numeric matrix.
#' Asymptotic covariance matrix of the standardized parameter vector.
#' @param type Character string.
#' Correction type.
#' Possible values are
#' `"hc0"`,
#' `"hc1"`,
#' `"hc2"`,
#' `"hc3"`,
#' `"hc4"`,
#' `"hc4m"`, and
#' `"hc5"`.
#' @param n Integer.
#' Sample size.
#' @param df Integer.
#' Degrees of freedom.
#'
#' @family Beta Sandwich Functions
#' @keywords betaSandwich cov internal
#' @noRd
.CovHC <- function(acov,
type,
n,
df) {
nstar <- ((n - 1)^2) / n
out <- (1 / nstar) * acov
if (type == "hc1") {
out <- (n / df) * out
}
return(
out
)
}
40 changes: 40 additions & 0 deletions R/betaSandwich-gamma-hc-dot.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#' Asymptotic Covariance Matrix of the Sample Covariance Matrix
#'
#' @author Ivan Jacob Agaloos Pesigan
#'
#' @param d Numeric matrix.
#' Centered data.
#' @param sigmacap Numeric matrix.
#' Covariance matrix of \eqn{Y, X_1, \dots, X_p}.
#' @param qcap Numeric vector
#' Leverage adjustment.
#' @param n Integer.
#' Sample size.
#'
#' @family BetaSandwich Functions
#' @keywords betaSandwich gamma internal
#' @noRd
.GammaHC <- function(d,
sigmacap,
qcap,
n) {
return(
(
1 / n
) * Reduce(
f = "+",
x = lapply(
X = seq_len(n),
FUN = function(i) {
qcap[i] * tcrossprod(
.Vech(
tcrossprod(
d[i, ]
) - sigmacap
)
)
}
)
)
)
}

0 comments on commit 6e6a425

Please sign in to comment.