acPCoA_prediction: Perform AC-PCoA on new data points for classification and...

Description Usage Arguments Value Examples

View source: R/acPCoA_prediction.R

Description

Perform AC-PCoA on new data points for classification and prediction

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
acPCoA_prediction(
  training.dist,
  testing.dist,
  training.confounder,
  training.label,
  testing.label,
  nPC = 2,
  kernel = "linear",
  bandwidth = NULL,
  lambdas = seq(0, 5, 0.05),
  anov = T,
  perc = 0.05
)

Arguments

training.dist

the n by n data distance matrix, where n is the number of training samples.

testing.dist

the n by m data distance matrix, where n is the number of training samples and m is the number of testing samples.

training.confounder

the n by q confounder matrix of training samples, where n is the number of samples, q is the number of confounding factors.

training.label

Label of traning samples for classification. Optional.

testing.label

Label of testing samples for classification. Optional.

nPC

number of principal components to compute

kernel

the kernel to use: "linear", "gaussian".

bandwidth

bandwidth h for Gaussian kernel. Optional.

lambdas

the tuning parameter, non-negative.

anov

True or False. Whether the penalty term has the between groups sum of squares interpretation. Default is True.

perc

the best lambda is defined to be the smallest lambda with R(lambda)<=perc (if anov=T), or R(lambda)<=perc*R(lambda=0) (if anov=F) in the nPC principal components.

Value

principal components and the projected data of training and testing samples

v

the principal components, p by nPC matrix

Xv_training

the projected data of training samples, i.e. X times v

Xv_testing

the projected data of testing samples

eigenvalueX

eigenvalues for the PCs

varianceX

variance explained by the PCs

PredictingAccuracy

the accuracy of predicting labels of testing samples using Random Forest, if training and testing labels are provided.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Not run: 
training.dist=data_mbqc_groupA$DistMat.BC[1:679,1:679]
testing.dist=data_mbqc_groupA$DistMat.BC[1:679,680:848]
training.confounder=data_mbqc_groupA$ConfounderMat[1:679,]
label=as.factor(data_mbqc_groupA$Specimen)
training.label=label[1:679]
testing.label=label[680:848]
result_prediction=acPCoA_prediction(training.dist,testing.dist,training.confounder,training.label,testing.label,nPC=2,kernel="linear",bandwidth=NULL,lambdas=seq(0, 5, 0.05),anov=T,perc=0.05)

## End(Not run)

YuWang28/acPCoA documentation built on Dec. 18, 2021, 8:20 p.m.