R/gamma_hat.R

Defines functions gamma_hat

Documented in gamma_hat

#' Estimate of gamma
#'
#' @param mat_covariance matrix containing sample covariance matrix.
#' @param mat_structurded matrix containing structured covariance matrix.
#' @param na.rm logical indicating whether \code{NA} values should be stripped
#'    before the computation proceeds.
#'
#' @return matrix of shape \eqn{p \times p}.
gamma_hat <- function(mat_covariance, mat_structurded, na.rm) {

  mat_cov_diff_sq <- (mat_covariance - mat_structurded)^2

  sum(mat_cov_diff_sq, na.rm = na.rm)

}
LeonardMK/covshrink documentation built on Dec. 18, 2021, 4:33 a.m.