Description Usage Arguments Value Author(s) References Examples
View source: R/PPCA_profile_log_likelihood.R
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.
1 |
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( |
M |
if |
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 |
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. |
profile log-likelihood of length n-1.
Wei Q. Deng, dengwq@mcmaster.ca
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>
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.