Cov cv

From Eigenvector Documentation Wiki
Jump to: navigation, search

This page describes the 'cov_cv' function and its usage.

Contents

Purpose

Estimation of a regularized inverse covariance matrix.

For (x) M by N, COV_CV estimates a regularized inverse of x'*x/(M-1).

If [V,S] = svd(x'*x/(M-1)), and S = diag(S); then the regularized inverse takes the form V*diag(1./(S+alpha))*V'.

The 1 by N vector alpha is output in (results.alpha) [see options.algorithm].

Synopsis

[ccov,results] = cov_cv(x,options);

Inputs

  • x = X-block class "double" or "dataset".

Optional Inputs

  • options = structure array with the following fields discussed below.

Outputs

  • ccov = the regularized (inverse and/or sqrt) covariance.
  • results = a structure array with the following fields
cond = condition number of x'*x/(M-1) [before after] regularization.
alpha = regularization parameters.
sd = the regularized eigenvalues (or sqrt) of Cov(X).
s = the eigenvalues (or sqrt) of Cov(X).
ss = the variances (or std) of X.
ncomp = number of facters at which S(1)/S = options.condmax (it can be a fraction).
options = the input (options) structure.

Options

options = a structure array with the following fields:

  • display: [ 'off' | {'on'} ], governs level of display to command window,
  • plots: [ 'none' | {'final'} ], governs level of plotting.
  • condmax: {1e4} maximum regularization (condmax>1). This is the maximum condition number for (ccov).
  • inverse: [ {'yes'} | 'no' ] If set to 'yes' {default} the inverse covariance matrix is estimated. If set to 'no' the output (ccov) is a regularized covariance matrix.
  • sqrt: [ {'no'} | 'yes' ], governs if the output is sqrt of the cov.
  • algorithm: [ 2 ], regularization method where ac = S(1)/options.condmax
algorithm = 1: results.alpha = (ac./(ac+S))*ac ;
algorithm = 2: results.alpha = (ac^2./(ac^2+S.^2))*ac ;
algorithm = 3: results.alpha = ac*ones(1,length(S)) ;
  • preprocessing: { [1] } Controls preprocessing.
Two methods can be used to control preprocessing.
1) For typical preprocessing methods use a scalar: 0 = none, {1 = mean centering, default}, or 2 = autoscaling.
2) For more varieties of preprocessing enter a cell array options.preprocessing = {pre} where pre is a standard preprocessing structure output by PREPROCESS.
  • calccov: [ 'no' | {'yes'} ].
If 'yes', it is assumed that the covariance matrix must first be calculated before estimating the inverse.
If 'no', it is assumed that input (x) is already a covariance and the calculation is not performed. If 'no' options.preprocessing is set to 0.

Example

load nir_data
[ccov,results] = cov_cv(spec1);
axis([0 50 1e-8 1]), vline(results.ncomp), hline(results.s(1)/results.options.condmax)
title(['nir_data: 30x401 ',get(get(gca,'title'),'string')],'interpreter','none'), figfont

See Also

pls, preprocess, stepwise_regrcls

Views
Personal tools