riflePCACV {EESPCA}R Documentation

Sparsity parameter selection via cross-validation for rifle method of Tan et al.

Description

Sparsity parameter selection for PCA-based rifle (as implemented by the rifle method in the rifle package) using the cross-validation approach of Witten et al. as implemented by the SPC.cv method in the PMA package.

Usage

    riflePCACV(X, k.values, nfolds=5)

Arguments

X

n-by-p data matrix being evaluated via PCA.

k.values

Set of truncation parameter values to evaluate via cross-validation. Values must be between 1 and p.

nfolds

Number of folds for cross-validation

Value

k value that generated the smallest cross-validation error.

References

See Also

rifleInit, rifle{rifle}, PMA{SPC.cv}

Examples

    set.seed(1)
    # Simulate 10x5 MVN data matrix
    X=matrix(rnorm(50), nrow=10)
    # Generate range of k values to evaluate
    k.values = 1:5
    # Use 5-fold cross-validation to estimate optimal k value
    riflePCACV(X=X, k.values=k.values)

[Package EESPCA version 0.7.0 Index]