Skip to content

Commit

Permalink
Automated build.
Browse files Browse the repository at this point in the history
  • Loading branch information
jeksterslab committed Oct 21, 2023
1 parent d930d60 commit ed1bb6e
Show file tree
Hide file tree
Showing 60 changed files with 113 additions and 5,148 deletions.
19 changes: 0 additions & 19 deletions .Rbuildignore

This file was deleted.

6 changes: 0 additions & 6 deletions .github/linters/.lintr

This file was deleted.

Binary file removed .setup/build/betaDelta.pdf
Binary file not shown.
Binary file removed .setup/build/betaDelta_1.0.3.9000.tar.gz
Binary file not shown.
11 changes: 0 additions & 11 deletions .setup/latex/bib/quarto.bib

This file was deleted.

6 changes: 0 additions & 6 deletions .setup/lint/.lintr

This file was deleted.

3 changes: 3 additions & 0 deletions .setup/pkgdown/_pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ reference:
- title: Differences of Standardized Regression Coefficients
contents:
- has_keyword("diff")
- title: Delta Method (Generic)
contents:
- has_keyword("deltaMethod")
- title: Methods
contents:
- has_keyword("methods")
Expand Down
104 changes: 104 additions & 0 deletions .setup/r-dependencies/deltaMethod/deltaMethod-delta-generic.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
#' Delta Method Confidence Intervals (Generic)
#'
#' @author Ivan Jacob Agaloos Pesigan
#'
#' @return Returns a numeric matrix with the following variables:
#' \describe{
#' \item{est}{Estimates}
#' \item{se}{Standard errors}
#' \item{t or z}{Test statistics}
#' \item{p}{p value}
#' \item{ci}{Confidence intervals}
#' }
#' Note that if `test = TRUE`, the `ci` columns are omitted.
#'
#' @param func An R function the input of which is `mu`.
#' The function should return a vector of any length.
#'
#' @param mu Numeric vector.
#' Input of `func`.
#' @param sigmacap Numeric vector or matrix.
#' Asymptotic covariance matrix of `mu`.
#' @param n Sample size.
#' @param theta Numeric vector.
#' Parameter values when the null hypothesis is true.
#' @param alpha Numeric vector.
#' Significance level/s.
#' @param z Logical.
#' If `z = TRUE`,
#' use the standard normal distribution.
#' If `z = FALSE`,
#' use the t distribution.
#' @param df Numeric.
#' Degrees of freedom if `z = FALSE`.
#' @param test Logical.
#' If `TRUE`,
#' return only the results of hypothesis tests.
#' If `FALSE`,
#' return both results of hypothesis tests and confidence intervals.
#'
#' @examples
#' g <- function(x) {
#' 1 / x
#' }
#' mu <- 100
#' sigmasq <- 225
#' n <- 30
#' DeltaGeneric(
#' func = g,
#' mu = mu,
#' sigmacap = sigmasq,
#' n = n
#' )
#' @importFrom numDeriv jacobian
#' @export
#' @family Delta Method Functions
#' @keywords deltaMethod
DeltaGeneric <- function(func,
mu,
sigmacap,
n,
theta = 0,
alpha = c(0.05, 0.01, 0.001),
z = TRUE,
df,
test = FALSE) {
stopifnot(
is.vector(mu)
)
stopifnot(
is.vector(sigmacap) | is.matrix(sigmacap)
)
k <- length(mu)
j <- numDeriv::jacobian(
func = func,
x = mu
)
if (k == 1) {
# univariate
sigmacap <- as.vector(sigmacap)
stopifnot(length(sigmacap) == 1)
vcov <- j^2 * (sigmacap / n)
se <- as.vector(sqrt(vcov))
} else {
# multivariate
stopifnot(
sigmacap == t(sigmacap),
dim(sigmacap)[1] == k
)
vcov <- j %*% (sigmacap / n) %*% t(j)
se <- as.vector(sqrt(diag(vcov)))
}
est <- func(mu)
return(
.CIWald(
est = est,
se = se,
theta = theta,
alpha = alpha,
z = z,
df = df,
test = test
)
)
}
3 changes: 2 additions & 1 deletion .setup/scripts/project.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ project <- "betaDelta"
pkg_cran <- c(
"lavaan",
"mice",
"betaSandwich"
"betaSandwich",
"numDeriv"
)

pkg_github <- c()
Expand Down
57 changes: 0 additions & 57 deletions CITATION.cff

This file was deleted.

3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ Encoding: UTF-8
LazyData: true
Roxygen: list(markdown = TRUE)
Depends: R (>= 3.5.0)
Imports:
numDeriv
Suggests:
knitr,
rmarkdown,
testthat,
betaSandwich
RoxygenNote: 7.2.3
2 changes: 0 additions & 2 deletions LICENSE

This file was deleted.

21 changes: 0 additions & 21 deletions LICENSE.md

This file was deleted.

14 changes: 0 additions & 14 deletions NAMESPACE

This file was deleted.

3 changes: 2 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# betaDelta 1.0.3.9000

* Latest development version.
*
* Added the `DeltaGeneric()` function.

# betaDelta 1.0.3

## Patch
Expand Down
26 changes: 0 additions & 26 deletions R/betaSandwich-jacobian-diff-beta-star-wrt-beta-star-dot.R

This file was deleted.

23 changes: 0 additions & 23 deletions R/dataSets-nas1982.R

This file was deleted.

20 changes: 0 additions & 20 deletions R/deltaMethod-acov-delta.R

This file was deleted.

Loading

0 comments on commit ed1bb6e

Please sign in to comment.