ppcaLog: Profile log-likelihood of the PPCA model.

Description Usage Arguments Value Author(s) References Examples

View source: R/PPCA_profile_log_likelihood.R

Description

The function returns the profile log-likelihood of the PPCA model for each possible choice of K (1, 2, …, n-1) at their respective MLEs. The maximum choice was set at n-1 because when K=n, the profile log-likelihood is equal to that at K=n-1.

Usage

1
ppcaLog(x = NULL, lambda = NULL, M = NULL, param = NULL, EM = FALSE)

Arguments

x

a data matrix where the number of rows is to be reduced; only complete columns are used

lambda

a numeric vector of sample eigenvalues of the covariance matrix of t(x)

M

if x were not supplied, M should be given as the number of columns of x.

param

a list of MLEs to be supplied if the profile log-likelihood was to be evaluate at external MLES; the first list should contain a loading matrix W with dimension n by K (≤ n); and the second a numeric value between 0 and 1 for the residual variance sigma2.

EM

a logic indicator for whether the profile log-likelihood should be computed for the MLE estimated using EM algorithms, if FALSE, the profile log-likelihood will be evaluated by substitute the analytical formulation of MLEs. Note that if n > m, it will not be possible to use this option.

Value

profile log-likelihood of length n-1.

Author(s)

Wei Q. Deng, dengwq@mcmaster.ca

References

Tipping, M. E., and Bishop, C. M. (1999). Probabilistic principal component analysis. **Journal of the Royal Statistical Society: Series B (Statistical Methodology)**, *61*(3), 611-622. <doi:10.1111/1467-9868.00196>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## Not run: 
library(MASS)
X <- mvrnorm(1000, mu = rep(0,10), Sigma = diag(1,10))
eigen_values <- eigen(as.matrix(Matrix::nearPD(stats::cov(scale(X)))$mat))$val
U <- pracma::randortho(10)
W <- U%*%diag(1, 10)%*%t(U)
sigma2 <- 0.4
ppcaLog(x = t(X), EM=TRUE) # supply a data matrix
ppcaLog(x = t(X), param = list(W, sigma2)) # supply a data matrix and MLEs
ppcaLog(lambda = eigen_values, M = 1000) # supply the sample eigenvalues

## End(Not run)

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