PCA for autoscaled data

Description

This function performs principal component analysis (PCA). In this function, data matrix is automatically scaled to zero mean and unit variance (autoscaling) for each metabolites. PC scores, factor loadings and the results of statistical test (p-value and q-value by Benjamini and Hochberg) are returned. In this function, factor loading is defined as a correlation coefficient between PC score and each metabolite levels.

Usage

1

Arguments

D

dataframe of metabolite IDs and data matrix (metabolites * samples)

Details

Blank must be set to missing values in data matrix. If standard deviation of metabolite levels is equal to zero, it is removed from PCA computation and the results of factor loadings are set to NA.

Value

list of PC scores, factor loadings, p-value and q-value (by Benjamini and Hochberg), and contribution ratios

Author(s)

Hiroyuki Yamamoto

References

Benjamini, Yoav and Hochberg, Yosef (1995). "Controlling the false discovery rate: a practical and powerful approach to multiple testing". Journal of the Royal Statistical Society, Series B (Methodological) 57 (1): 289-300.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
	# --------------
	#  Sample data
	# --------------
	X <- matrix(runif(1000),nrow=100,ncol=10) # 100(metabolites)*10(samples)
	M <- as.character(c(1:100)) # metabolite IDs
	D <- data.frame(M,X)	# dataframe of metabolite IDs and data matrix

	# ---------------------------
	#  PCA for autoscaled data
	# ---------------------------
	A <- pca_scaled(D) 		# automatically scaled in pca_scaled function

	# ---------
	#  Result
	# ---------
	A[["score"]]			# PC score
	A[["factor.loading"]] 		# factor loading
	A[["p.value"]] 			# p-value of factor loading
	A[["q.value"]] 			# q-value of factor loading