| Title: | Penalized Likelihood Factor Analysis via Nonconvex Penalty |
|---|---|
| Description: | Computes the penalized maximum likelihood estimates of factor loadings and unique variances for various tuning parameters. The pathwise coordinate descent along with EM algorithm is used. This package also includes a new graphical tool which outputs path diagram, goodness-of-fit indices and model selection criteria for each regularization parameter (Yamamoto, M., Hirose, K. and Nagata, H., 2017 <doi:10.1007/s41237-016-0007-3>). The user can change the regularization parameter by manipulating scrollbars, which is helpful to find a suitable value of regularization parameter. As a penalty, we can choose either the minimax concave penalty (Hirose, K. and Yamamoto, M., 2015 <doi:10.1007/s11222-014-9458-0>; Hirose, K. and Yamamoto, M., 2014 <doi:10.1016/j.csda.2014.05.011>) or the product-based elastic net penalty (Hirose, K. and Terada, Y., 2023 <doi:10.1007/s11336-022-09868-4>). |
| Authors: | Kei Hirose [aut, cre] (ORCID: <https://orcid.org/0000-0001-9827-0356>), Michio Yamamoto [aut], Haruhisa Nagata [aut] |
| Maintainer: | Kei Hirose <[email protected]> |
| License: | GPL (>= 2) |
| Version: | 2.3.13 |
| Built: | 2026-06-05 12:04:18 UTC |
| Source: | https://github.com/cran/fanc |
This package computes the solution path of penalized maximum likelihood estimates via MC+ penalties.
fanc(x, factors, n.obs, rho, gamma, cor.factor=FALSE, normalize=TRUE, normalize.penalty=FALSE, covmat, type="MC", model="FA", control=list())fanc(x, factors, n.obs, rho, gamma, cor.factor=FALSE, normalize=TRUE, normalize.penalty=FALSE, covmat, type="MC", model="FA", control=list())
x |
A data matrix. |
factors |
The number of factors. |
cor.factor |
An indicator of the factor correlation. If |
normalize |
If |
normalize.penalty |
If |
rho |
The values of rho. It can be a scalar or a matrix. |
gamma |
The values of gamma. It must be a vector. |
covmat |
A covariance matrix, which is needed if the data matrix |
n.obs |
The number of observations, which is needed to calculate the model selection criteria and goodness-of-fit indices when the data matrix |
type |
Type of penalty. If |
model |
Type of model. |
control |
A list of control parameters. See ‘Details’. |
The control argument is a list that can supply any of the following components:
length.rhoCandidates of tuning parameters which is used for grid search of reparametrization of MC+.
length.gammaA length of tuning parameter which controls sparsenesses. For each rho, gamma=Inf yields soft threshold operator (i.e., lasso penalty) and gamma=+1 produces hard threshold operator.
Maximum value of rho.
max.gammaA maximum value of gamma (excludes Inf.).
min.gammaA minimum value of gamma.
etaA tuning parameter used for preventing the occurrence of improper solutions. eta must be non-negative.
ncand.initialThe number of candidates of initial values of factor loadings.
ncand.initial.prenetThe number of candidates of initial values for prenet penalty. Because the prenet penalty is unstable when rho is large, ncand.initial.prenet must be large. Default is 1000.
maxit.emA maximum number of iterations for EM algortihm.
maxit.cdA maximum number of iterations for coordinate descent algortihm.
maxit.bfgsA maximum number of iterations for BFGS algorithm used in the update of factor correlation.
maxit.initialA maximum number of iterations for choosing the initial values.
startType of start. If "cold", the initial value of factor loadings is randomly chosen for each tuning parameter, which can be slow.
DeltaA proportion of maximum value of rho to minimum value of rho, i.e., rho.min
=Delta*rho.max.
min.uniquevarA minimum value of unique variances.
tol.emA positive scalar giving the tolerance at which the parameter in EM is considered close enough to zero to terminate the algorithm.
tol.cdA positive scalar giving the tolerance at which the factor loadings in coordinate descent is considered close enough to zero to terminate the algorithm.
tol.bfgsA positive scalar giving the tolerance at which the factor correlation in BFGS algorithm is considered close enough to zero to terminate the algorithm.
min.rhozeroIf "TRUE", the minimum value of "rho" is zero.
zitaA value of hyper-parameter of factor correlation.
progressIf "TRUE", the progress for each tuning parameter is displayed.
openmpIf "TRUE", the parallel computation via OpenMP is excecuted.
num.threadsThe number of threads of the openmp. Only used when openmp is "TRUE",
gamma.ebicThe value of gamma used in the extended BIC
loadings |
factor loadings |
uniquenesses |
unique variances |
Phi |
factor correlation |
rho |
rho |
AIC |
AIC |
BIC |
BIC |
CAIC |
CAIC |
df |
degrees of freedom (number of non-zero parameters for the lasso estimation) |
criteria |
values of AIC, BIC and CAIC |
goodness.of.fit |
values of GFI and AGFI |
gamma |
a value of gamma |
Npflag |
If the number of observation is larger than the number of variables, 1, otherwise 0. |
factors |
the number of factors |
cor.factor |
An indicator of the factor correlation |
x |
data matrix |
convergence |
indicator of convergence of EM algorithm, coordinate descent and BFGS. If all of these variables are 0, the algorithm has been converged |
Kei Hirose
[email protected]
Hirose, K. and Yamamoto, M. (2014).
Sparse estimation via nonconcave penalized likelihood in a factor analysis model,
Statistics and Computing, in press
out and plot.fanc objects.
#generate data 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 data fit <- fanc(x,2) fit2 <- fanc(x,2,cor.factor=TRUE) #factor correlation is estimated #print candidates of gamma and rho print(fit) #output for fixed tuning parameters out(fit, rho=0.1, gamma=Inf) #select a model via model selection criterion select(fit, criterion="BIC", gamma=Inf) ## Not run: #plot solution path plot(fit) ## End(Not run)#generate data 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 data fit <- fanc(x,2) fit2 <- fanc(x,2,cor.factor=TRUE) #factor correlation is estimated #print candidates of gamma and rho print(fit) #output for fixed tuning parameters out(fit, rho=0.1, gamma=Inf) #select a model via model selection criterion select(fit, criterion="BIC", gamma=Inf) ## Not run: #plot solution path plot(fit) ## End(Not run)
This functions give us the loadings from a "fanc" object for fixed value of gamma.
out(x, rho, gamma, scores=FALSE, df.method="active")out(x, rho, gamma, scores=FALSE, df.method="active")
x |
Fitted |
gamma |
The value of gamma. |
rho |
The value of rho. |
scores |
Logical flag for outputting the factor scores. Defalut is FALSE. |
df.method |
Two types of degrees of freedom are supported. If |
loadings |
factor loadings |
uniquenesses |
unique variances |
Phi |
factor correlation |
scores |
factor scores |
df |
degrees of freedom (number of non-zero parameters for the lasso estimation) |
criteria |
values of AIC, BIC and CAIC |
goodness.of.fit |
values of GFI and AGFI |
rho |
a value of rho |
gamma |
a value of gamma |
Kei Hirose
[email protected]
Hirose, K. and Yamamoto, M. (2014).
Sparse estimation via nonconcave penalized likelihood in a factor analysis model,
Statistics and Computing, in press
fanc and plot.fanc objects.
This functions plots the solution paths from a "fanc" object for fixed value of gamma.
## S3 method for class 'fanc' plot(x, Window.Height=500, type=NULL, df.method="active", ...)## S3 method for class 'fanc' plot(x, Window.Height=500, type=NULL, df.method="active", ...)
x |
Fitted |
Window.Height |
A window height. The default is 500. |
type |
Two plot types are supported. If |
df.method |
Two types of degrees of freedom are supported. If |
... |
Other graphical parameters to plot |
NULL
Kei Hirose
[email protected]
Hirose, K. and Yamamoto, M. (2014).
Sparse estimation via nonconcave penalized likelihood in a factor analysis model,
Statistics and Computing, in press
fanc and out objects.
This functions give us the loadings from a "fanc" object for fixed value of gamma.
select(x, criterion=c("BIC","AIC","CAIC","EBIC"), gamma, scores=FALSE, df.method="active")select(x, criterion=c("BIC","AIC","CAIC","EBIC"), gamma, scores=FALSE, df.method="active")
x |
Fitted |
criterion |
The criterion by which to select the tuning parameter rho. One of "AIC", "BIC", "CAIC", or "EBIC". Default is "BIC". |
gamma |
The value of gamma. |
scores |
Logical flag for outputting the factor scores. Defalut is FALSE. |
df.method |
Two types of degrees of freedom are supported. If |
loadings |
factor loadings |
uniquenesses |
unique variances |
Phi |
factor correlation |
scores |
factor scores |
df |
degrees of freedom (number of non-zero parameters for the lasso estimation) |
criteria |
values of AIC, BIC and CAIC |
goodness.of.fit |
values of GFI and AGFI |
rho |
a value of rho |
gamma |
a value of gamma |
Kei Hirose
[email protected]
Hirose, K. and Yamamoto, M. (2014).
Sparse estimation via nonconcave penalized likelihood in a factor analysis model,
Statistics and Computing, in press
fanc and plot.fanc objects.