R/hard.thresholding.R

Defines functions hard.thresholding

Documented in hard.thresholding

#' @title Hard-Thresholding Opreator on Covariance Matrix
#'
#' @description
#' Apply hard-thresholding operator on a covariance matrix with 
#' a hard-thresholding parameter.
#'
#' @param sigma a p*p covariance matrix
#' @param threshold hard-thresholding parameter
#' @return a regularized covariance matrix after hard-thresholding operation
#' @references "High-Dimensional Covariance Estimation" by Mohsen Pourahmadi
#' @examples
#' data(m.excess.c10sp9003)
#' cov.SAM <- cov(m.excess.c10sp9003)
#' hard.thresholding(cov.SAM, threshold = 0.001)
#' @export

hard.thresholding <- function(sigma, threshold = 0.5) {
  sigma[(sigma != diag(diag(sigma))) & (abs(sigma) < threshold)] <- 0
  return(sigma)
}

Try the FinCovRegularization package in your browser

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

FinCovRegularization documentation built on May 29, 2017, 11:47 a.m.