Description Usage Arguments Value Examples
The log-likelihood of the data for probabilistic PCA is known to be multivariate Gaussian. Using this, one can check the log-likelihood value of the observed data values given the parameter estimates from the PCA model. This can be useful to compare different models.
1 | compute_loglikeobs(dat, covmat, meanvec, verbose = TRUE)
|
dat |
|
covmat |
|
meanvec |
|
verbose |
|
the log-likelihood value
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | p <- 20
n <- 7
set.seed(10045)
X <- matrix(rnorm(p*n), p, n)
miss.inds <- sample(1:(p*n), (p*n)/4)
X[miss.inds] <- NA
M <- !is.na(X)
Nobs_i <- rowSums(M)
Mu <- rowSums(X, na.rm = TRUE) / Nobs_i
Mu2 <- rep(0, p)
covmat <- diag(p)
# using sample mean
compute_loglikeobs(dat=X, covmat=covmat, meanvec=Mu, verbose=TRUE)
# using zero mean
compute_loglikeobs(dat=X, covmat=covmat, meanvec=Mu2, verbose=TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.