bestPC {lpda} | R Documentation |
Choosing the best number of Principal Components (PCs) for lpda-pca model.
Description
bestPC
computes the classification error for lpda.pca models applied with the number of components specified in PCs argument. The result is the average classification error rate from the R models computed for each number of PCs.
Usage
bestPC(data, group, ntest = 10, R = 10, PCs = c(10,15,20), f1 = NULL, f2 = NULL)
Arguments
data |
Matrix containing data. Individuals in rows and variables in columns |
group |
Vector with the variable group |
ntest |
Number of samples to evaluate in the test-set. |
R |
Times the model is evaluated with each Variability indicated in Vars vector. |
PCs |
The PCs to check. |
f1 |
Vector with weights for individuals of the first group. If NULL they are equally weighted. |
f2 |
Vector with weights for individuals of the second group. If NULL they are equally weighted. |
Value
bestPC
returns a vector with the average prediction error rate obtained from the R models for each PC specified in PCs input.
Author(s)
Maria Jose Nueda, mj.nueda@ua.es
See Also
Examples
data(RNAseq)
group = as.factor(rep(c("G1","G2"), each = 30))
bestPC(RNAseq, group, ntest = 10, R = 5, PCs = c(2, 10))