psi_hyper: Find sensible inverse gamma hyperparameters for...

View source: R/FullConditionals.R

psi_hyperR Documentation

Find sensible inverse gamma hyperparameters for variance/uniqueness parameters

Description

Takes an inverse-Gamma shape hyperparameter, and an inverse covariance matrix (or estimate thereof), and finds data-driven scale hyperparameters in such a way that Heywood problems are avoided for factor analysis or probabilistic principal components analysis (and mixtures thereof).

Usage

psi_hyper(shape,
          dat,
          type = c("unconstrained", "isotropic"),
          beta0 = 3,
          ...)

Arguments

shape

A positive shape hyperparameter.

dat

The data matrix for which the inverse covariance matrix is to be estimated. If data are to be centered &/or scaled within mcmc_IMIFA, then dat must also be standardised in the same way.

type

A switch indicating whether a single scale (isotropic) or variable-specific scales (unconstrained) are to be derived. Both options are allowed under models in mcmc_IMIFA with "constrained" or "unconstrained" uniquenesses, but only a single scale can be specified for models with "isotropic" or "single" uniquenesses.

beta0

See Note below. Must be a strictly positive numeric scalar. Defaults to 3, but is only invoked when explicitly supplied or when the number of observations N is not greater than the number of variables P (or when inverting the sample covariance matrix somehow otherwise fails). In some cases, beta0 should not be so small as to render the estimate of the inverse unstable.

...

Catches unused arguments. Advanced users can also supply the sample covariance matrix of dat, if available, through ... via the argument covar.

Details

Constraining uniquenesses to be isotropic provides the link between factor analysis and the probabilistic PCA model. When used in conjunction with mcmc_IMIFA with "isotropic" or "single" uniquenesses, type must be isotropic, but for "unconstrained" or "constrained" uniquenesses, it's possible to specify either a single scale (type="isotropic") or variable-specific scales (type="unconstrained").

Used internally by mcmc_IMIFA when its argument psi_beta is not supplied.

Value

Either a single scale hyperparameter or ncol(dat) variable-specific scale hyperparameters.

Note

When N > P, where N is the number of observations and P is the number of variables, the inverse of the sample covariance matrix is used by default.

When N <= P, the inverse either does not exist or the estimate thereof is highly unstable. Thus, an estimate of the form (beta0 + N/2) * solve(diag(beta0, P) + 0.5 * crossprod(dat)) is used instead.

For unstandardised data, the estimate is instead constructed using a standardised version of the data, and the resulting inverse correlation matrix estimate is scaled appropriately by the diagonal entries of the sample covariance matrix of the original data.

This estimate can also be used in N > P cases by explicitly supplying beta0. It will also be used if inverting the sample covariance matrix fails in N > P cases.

The optional argument beta0 can be supplied to mcmc_IMIFA via the control function mixfaControl.

Author(s)

Keefe Murphy - <keefe.murphy@mu.ie>

References

Murphy, K., Viroli, C., and Gormley, I. C. (2020) Infinite mixtures of infinite factor analysers, Bayesian Analysis, 15(3): 937-963. <doi:10.1214/19-BA1179>.

Fruwirth-Schnatter, S. and Lopes, H. F. (2010). Parsimonious Bayesian factor analysis when the number of factors is unknown, Technical Report. The University of Chicago Booth School of Business.

Fruwirth-Schnatter, S. and Lopes, H. F. (2018). Sparse Bayesian factor analysis when the number of factors is unknown, to appear. <arXiv:1804.04231>.

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.

See Also

mcmc_IMIFA, mixfaControl

Examples

data(olive)
olive2  <- olive[,-(1:2)]
shape   <- 2.5
(scale1 <- psi_hyper(shape=shape, dat=olive2))

# Try again with scaled data
olive_S <- scale(olive2, center=TRUE, scale=TRUE)

# Use the inverse of the sample covariance matrix
(scale2 <- psi_hyper(shape=shape, dat=olive_S))

# Use the estimated inverse covariance matrix
(scale3 <- psi_hyper(shape=shape, dat=olive_S, beta0=3))

# In the normalised example, the mean uniquenesses (given by scale/(shape - 1)),
# can be interpreted as the prior proportion of the variance that is idiosyncratic
(prop1   <- scale1/(shape - 1))
(prop2   <- scale2/(shape - 1))

IMIFA documentation built on Dec. 28, 2022, 1:58 a.m.