Learn R Programming

CODEX (version 1.4.0)

choiceofK: Determine the number of latent factors K.

Description

Determines the number of latent variables K via AIC, BIC, and deviance reduction. A pdf file containing all three plots is generated.

Usage

choiceofK(AIC, BIC, RSS, K, filename)

Arguments

AIC
vector of AIC for each K returned from normalize
BIC
vector of BIC for each K returned from normalize
RSS
vector of RSS for each K returned from normalize
K
vector of K returned from normalize
filename
Filename of the output plot of AIC and RSS

Value

pdf file with three plots: AIC, BIC, and percentage of variance explained versus the number of latent factors.

Details

AIC: Akaike information criterion, used for model selection; BIC: Bayesian information criterion, used for model selection; RSS: residue sum of squares, used to plot scree plot and determine the 'elbow'.

See Also

normalize, segment

Examples

Run this code
AIC <- normObjDemo$AIC
BIC <- normObjDemo$BIC
RSS <- normObjDemo$RSS
K <- normObjDemo$K
projectname <- bambedObjDemo$projectname
chr <- bambedObjDemo$chr
choiceofK(AIC, BIC, RSS, K, filename = paste(projectname, "_", chr, 
    "_choiceofK", ".pdf", sep = ""))

Run the code above in your browser using DataLab