knitr::opts_chunk$set( tidy = TRUE, collapse = TRUE, comment = "#>", fig.path = "README-")
You can install the release version of ShrinkCovMat
:
install.packages("ShrinkCovMat")
The source code for the release version of ShrinkCovMat
is available on CRAN at:
Or you can install the development version of ShrinkCovMat
:
# install.packages('devtools') devtools::install_github("AnestisTouloumis/ShrinkCovMat")
The source code for the development version of ShrinkCovMat
is available on github at:
To use ShrinkCovMat
, you should first load the package as follows:
library("ShrinkCovMat")
This package provides estimates of the covariance matrix and in particular, it implements the nonparametric Stein-type shrinkage covariance matrix estimators proposed in @Touloumis2015. These estimators are suitable and statistically efficient regardless of the dimensionality.
Each of the three implemented shrinkage covariance matrix estimates is a convex linear combination of the sample covariance matrix and of a target matrix. The core function is called shrinkcovmat
and the argument target
defines one of the following three options for the target matrix:
target = "identity"
),target = "spherical"
),target = "diagonal"
).Calculation of the corresponding optimal shrinkage intensities is discussed in @Touloumis2015.
The utility function targetselection
is designed to ease the selection of the target matrix. This is based on empirical observation by inspecting the estimated optimal intensities and the range and average of the sample variances.
Consider the colon cancer data example analyzed in @Touloumis2015. The data consists of two tissue groups: the normal tissue group and the tumor tissue group.
data(colon) normal_group <- colon[, 1:40] tumor_group <- colon[, 41:62]
To decide the target matrix for covariance matrix of the normal group, inspect the following output:
targetselection(normal_group)
The estimated optimal shrinkage intensity for the spherical matrix is slightly larger than the other two. In addition the sample variances appear to be of similar magnitude and their average is smaller than 1. Thus, the spherical matrix seems to be the most appropriate target for the covariance matrix. The resulting covariance matrix estimate is:
estimated_covariance_normal <- shrinkcovmat(normal_group, target = "spherical") estimated_covariance_normal
We follow a similar procedure for the tumor group:
targetselection(tumor_group)
As before, we may choose the spherical matrix as the target matrix. The resulting covariance matrix estimate for the tumor group is:
estimated_covariance_tumor <- shrinkcovmat(tumor_group, target = "spherical") estimated_covariance_tumor
citation("ShrinkCovMat")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.