getTargetSet: Construct a set of target matrices for Target-Averaged linear...

Description Usage Arguments Value See Also Examples

View source: R/RcppExports.R

Description

Construct a set of popular target matrices from the linear shrinkage literature. These nine targets consist of the combinations of variance and correlation structures; variance structures are unit, sample mean, and sample; correlation structures are zero, sample mean, and autocorrelation.

Usage

1

Arguments

X

matrix – data matrix with variables in rows and observations in columns.

Value

array – a pxpx9 array of target matrices, where p is the number of variables of X.

See Also

taShrink

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
  set.seed(102)
  X <- matrix(rnorm(50), 10, 5) # p=10, n=5, identity covariance
  X <- t(scale(t(X), center=TRUE, scale=FALSE)) # mean 0
  ts <- getTargetSet(X) # an array of targets
  # inspect the variances of the targets
  vars <- apply(ts, 3, diag)
  colnames(vars) <- paste("target", c(1:9), sep="")
  vars
  boxplot(vars, ylab = "variances")
  # inspect the correlations of the targets
  corrs <- apply(ts, 3, function(x){cov2cor(x)[lower.tri(x)]})
  colnames(corrs) <- paste("target", c(1:9), sep="")
  corrs
  boxplot(corrs, ylab = "correlations")

HGray384/TAS documentation built on Dec. 14, 2020, 8:41 p.m.