R/betaSandwich-jacobian-diff-beta-star-wrt-beta-star-dot.R

Defines functions .JacobianDiffBetaStar

#' 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)
}

Try the betaDelta package in your browser

Any scripts or data that you put into this service are public.

betaDelta documentation built on May 29, 2024, 1:58 a.m.