choiceofK {CODEX} | R Documentation

## 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

### 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'.

### Value

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

### Author(s)

Yuchao Jiang yuchaoj@wharton.upenn.edu

### See Also

`normalize`, `segment`

### Examples

    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 = ""))

[Package CODEX version 1.22.0 Index]