Learn R Programming

CVTuningCov (version 1.0)

random.CV: Select Tuning Parameter for Regularized Covariance Matrix by Random CV

Description

Apply a random cross-validation (CV) to select tuning parameters for regualrized covariance matrix with banding, tapering, soft-thresholding or hard-thresholding method under the Frobenius norm or the operator norm. The random CV randomly splits the data set to two parts, a training set and a validation set with user-specifed sizes, and repeats the process for multiple times.

Usage

random.CV(X, k.grid = 0.5, method = "Tapering", test.size = 5, norm = "F", 
boot.num = 50, seed = 10323)

Arguments

X
input data matrix with dimension n*p. n indicates the sample size and p indicates the dimension of the corresponding random vector.
k.grid
the default value is 0.5.
method
the regularized method, which can be "Banding", "Tapering", "HardThresholding" or "SoftThresholding". the default value is "Tapering".
test.size
the size of the validation set, which should be < n.
norm
the norms which can be used to measure the estimation accuracy, which can be the Frobenius norm "F" or the operator norm "L2".
boot.num
the number of random split. The default value is 50.
seed
the default value is 10323.

Value

  • A list including elements:
  • CV.kthe optimal tuning parameter selected by the random CV.
  • k.gridthe vector of tuning parameters
  • CV.pre.errora vector denoting predicting errors by random CV at each element of tuning parameters based on the selected norm.

Examples

Run this code
library(MASS);
n <- 50;
p <- 50;
fold <- 3;
k.grid <- seq(0,2*(p-1),by=1);
Sigma <- AR1(p, rho=0.6);
X <- mvrnorm(n,rep(0,p),Sigma);
CV.F.fit <- random.CV(X,k.grid, method='Tapering',test.size = 10,norm='F');
CV.F.fit$CV.k;

Run the code above in your browser using DataLab