| fanc | R Documentation |
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.
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, ...)
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 |
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 |
normalize |
Logical; if |
normalize.penalty |
Logical; if |
covmat |
A covariance matrix, used when the data matrix |
type |
Penalty type: |
model |
Model type: |
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. |
The control argument can contain the following components:
length.rhoNumber of rho candidates.
length.gammaNumber of gamma candidates.
max.rhoMaximum rho. For prenet and enet, a scalar is repeated for every gamma. Alternatively, supply one value per gamma. Other lengths are invalid.
max.gammaMaximum finite gamma.
min.gammaMinimum gamma.
etaNon-negative tuning parameter used to prevent improper solutions.
ncand.initialNumber of candidate initial loading matrices. The default is 10.
ncand.initial.prenetNumber of candidate initial values for the prenet penalty. The default is 100.
maxit.emMaximum number of EM iterations.
maxit.cdMaximum number of coordinate-descent iterations.
maxit.bfgsMaximum number of BFGS iterations.
maxit.initialMaximum number of iterations used when choosing initial values.
startStarting-value strategy, either "warm" or "cold".
DeltaRatio of the minimum rho to the maximum rho.
min.uniquevarMinimum unique variance.
tol.emConvergence tolerance for the EM algorithm.
tol.cdConvergence tolerance for coordinate descent.
tol.bfgsConvergence tolerance for BFGS.
min.rhozeroLogical; if TRUE, the minimum rho is zero.
zitaHyper-parameter for factor correlations.
progressLogical; if TRUE, fitting progress is displayed.
openmpLogical; if TRUE, OpenMP parallel computation is requested.
num.threadsNumber of OpenMP threads.
gamma.ebicGamma used in the extended BIC.
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 |
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.
Kei Hirose
mail@keihirose.com
Hirose, K. and Yamamoto, M. (2015). Sparse estimation via nonconcave penalized likelihood in a factor analysis model, Statistics and Computing, 25, 633–648.
out, select, and plot.fanc.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.