fanc: Penalized Likelihood Factor Analysis via Nonconvex Penalties

View source: R/fanc.R

fancR Documentation

Penalized Likelihood Factor Analysis via Nonconvex Penalties

Description

Computes solution paths of penalized maximum likelihood estimates for factor analysis or probabilistic principal component analysis. The available penalties are MC+, the product-based elastic net (prenet), and the elastic net.

Usage

fanc(x, factors, n.obs, rho, gamma, cor.factor=FALSE, normalize=TRUE,
     normalize.penalty=FALSE, covmat, type="MC", model="FA", control=list())

## S3 method for class 'fanc'
print(x, digits=max(3, getOption("digits") - 3),
                     num.result=20, ...)

Arguments

x

A numeric data matrix.

factors

The number of factors.

n.obs

The number of observations. This is required to calculate model-selection criteria and goodness-of-fit indices when only covmat is supplied. If it is omitted, model fitting is performed but these indices are unavailable.

rho

Values of rho. This may be a scalar or a matrix with one column for each gamma value.

gamma

Values of gamma.

cor.factor

Logical; if TRUE, factor correlations are estimated. The default is FALSE.

normalize

Logical; if TRUE, each variable is normalized. The default is TRUE.

normalize.penalty

Logical; if TRUE, variable-specific penalty weights are calculated. The default is FALSE.

covmat

A covariance matrix, used when the data matrix x is unavailable.

type

Penalty type: "MC", "prenet", or "enet". The default is "MC".

model

Model type: "FA" for factor analysis or "PPCA" for probabilistic principal component analysis. The default is "FA".

control

A list of control parameters. See ‘Details’.

digits

Number of digits used by the print method.

num.result

Retained for compatibility with earlier versions; it currently does not change the printed output.

...

Reserved for compatibility; currently unused.

Details

The control argument can contain the following components:

length.rho

Number of rho candidates.

length.gamma

Number of gamma candidates.

max.rho

Maximum rho. For prenet and enet, a scalar is repeated for every gamma. Alternatively, supply one value per gamma. Other lengths are invalid.

max.gamma

Maximum finite gamma.

min.gamma

Minimum gamma.

eta

Non-negative tuning parameter used to prevent improper solutions.

ncand.initial

Number of candidate initial loading matrices. The default is 10.

ncand.initial.prenet

Number of candidate initial values for the prenet penalty. The default is 100.

maxit.em

Maximum number of EM iterations.

maxit.cd

Maximum number of coordinate-descent iterations.

maxit.bfgs

Maximum number of BFGS iterations.

maxit.initial

Maximum number of iterations used when choosing initial values.

start

Starting-value strategy, either "warm" or "cold".

Delta

Ratio of the minimum rho to the maximum rho.

min.uniquevar

Minimum unique variance.

tol.em

Convergence tolerance for the EM algorithm.

tol.cd

Convergence tolerance for coordinate descent.

tol.bfgs

Convergence tolerance for BFGS.

min.rhozero

Logical; if TRUE, the minimum rho is zero.

zita

Hyper-parameter for factor correlations.

progress

Logical; if TRUE, fitting progress is displayed.

openmp

Logical; if TRUE, OpenMP parallel computation is requested.

num.threads

Number of OpenMP threads.

gamma.ebic

Gamma used in the extended BIC.

Value

An object of class "fanc". Important components include:

loadings

Factor-loading matrices for every rho and gamma.

uniquenesses

Unique variances for every rho and gamma.

Phi

Factor-correlation matrices.

rho

Matrix of rho values.

gamma

Vector of gamma values.

df, dfnonzero

Degrees of freedom.

AIC, BIC, CAIC, EBIC

Model-selection criteria based on reparametrized degrees of freedom.

AIC_dfnonzero, BIC_dfnonzero, CAIC_dfnonzero, EBIC_dfnonzero

Model-selection criteria based on active parameters.

GFI, AGFI, CFI, RMSEA, SRMR

Goodness-of-fit indices.

AGFI_dfnonzero, CFI_dfnonzero, RMSEA_dfnonzero

Goodness-of-fit indices based on active parameters.

factors

Number of factors.

cor.factor

Whether factor correlations were estimated.

x

The original data matrix, or NULL when only covmat was supplied.

convergence

Convergence indicators for the fitting algorithms.

type, model

Penalty and model types.

When only covmat is supplied and n.obs is omitted, the model-selection criteria and goodness-of-fit indices are NULL.

Author(s)

Kei Hirose
mail@keihirose.com

References

Hirose, K. and Yamamoto, M. (2015). Sparse estimation via nonconcave penalized likelihood in a factor analysis model, Statistics and Computing, 25, 633–648.

See Also

out, select, and plot.fanc.

Examples

set.seed(0)
loadings0 <- matrix(c(rep(0.8, 5), rep(0, 5),
                      rep(0, 5), rep(0.8, 5)), 10, 2)
common.factors0 <- matrix(rnorm(50 * 2), 50, 2)
unique.factors0 <- matrix(rnorm(50 * 10, sd=sqrt(0.36)), 50, 10)
x <- common.factors0 %*% t(loadings0) + unique.factors0

fit <- fanc(x, 2)
print(fit)
out(fit, rho=0.1, gamma=Inf)
select(fit, criterion="BIC", gamma=Inf)

## Not run: 
plot(fit)
plot(fit, file="fanc-viewer.html")

## End(Not run)

fanc documentation built on July 26, 2026, 9:06 a.m.

Related to fanc in fanc...