pPPCA: Penalized Probabilistic PCA

Description Usage Arguments Value Examples

View source: R/pPPCA.R

Description

The function returns the results of penalized profile log-likelihood given a matrix of data or a vector of sample eigenvalues. The data matrix is assumed to follow the decomposition X = WL + ε, where rows of X are decomposed to a linear projection in an orthogonal space plus error. The solution finds the rank of W, which represents some hidden structure in the data, such that X-WL have independent and identically distributed components.

Usage

1
2
3
4
5
6
7
8
pPPCA(
  lambda,
  Tvotes = 1000,
  verbose = FALSE,
  penalty = 1,
  tau = 0.001,
  beta = NULL
)

Arguments

lambda

a numerical vector of sample eigenvalues

Tvotes

the number of possible tuning parameter values to be searched

verbose

a logical to indicate whether the details of the penalized voting results should be shown

penalty

an integer indicating the type of penalty function to use. The default option is 1, which corresponds to the model in Deng and Craiu (2021).

tau

a tolerance threshold for the smallest eigenvalue, the default value is 0.001.

beta

a numeric between 0 and 1 indicating the weight towards penalty function 1 or 2.

Value

an integer $K$ between 1 and $n$.

Examples

1
2
3
4
5
6
7
8
## Not run: 
library(MASS)
normdata <- mvrnorm(1000, mu = rep(0,50), Sigma = diag(1,50))
eigen_values <- eigen(as.matrix(Matrix::nearPD(stats::cov(scale(normdata)))$mat))$val

pPPCA(lambda = lambda) # supply the sample eigenvalues

## End(Not run)

WeiAkaneDeng/SPAC2 documentation built on Jan. 15, 2022, 5:01 a.m.