get_pcom: gets PCA scores from data subset

Description Usage Arguments Value Author(s) Examples

View source: R/contselec-package8.R

Description

This function returns PCA scores for the 1th,...,"np"th principal components of "data0s" so that [explained variance]/[total variance] is larger than "edge_explain"

Usage

1
get_pcom(data0s, edge_explain, np = -1, scale = FALSE)

Arguments

data0s

: data.frame or matrix

edge_explain

real number : "np" is chosen so that [explained variance]/[total variance] > "edge_explain", when "np" is not given

np

integer : number of principal components extracted

scale

TRUE/FALSE : if TRUE, variables are scaled in advance so that mean=0 and sd=1.

Value

list(np, data0s_pcom), where "np" (integer) is number of principal components, and "data0s_pcom" (matrix) contains PCA scores for the corresponding principal components.

Author(s)

Hiroshi C. Ito

Examples

1
2
3
4
5
6
7
data(Cars93, package = "MASS");
data=Cars93
data=data[complete.cases(data),];
data=data[,sapply(data[1,],is.numeric)];
gid=assign_gid(data,edge_cor=0.8);
print(gid);
pcom=get_pcom(data[,gid==2],edge_explain=0.85,scale=TRUE);

yorickuser/contselec documentation built on July 25, 2021, 8:14 a.m.