pefa: Partially Exploratory Factor Analysis

View source: R/pefa.R

pefaR Documentation

Partially Exploratory Factor Analysis

Description

PEFA is a partially exploratory approach to factor analysis, which can incorporate partial knowledge together with unknown number of factors, using bi-level Bayesian regularization. When partial knowledge is not needed, it reduces to the fully exploratory factor analysis (FEFA; Chen, 2021). A large number of factors can be imposed for selection where true factors will be identified against spurious factors. The loading vector is reparameterized to tackle model sparsity at the factor and loading levels with the multivariate spike and slab priors. Parameters are obtained by sampling from the posterior distributions with the Markov chain Monte Carlo (MCMC) techniques. The estimation results can be summarized with summary.lawbl and the trace or density of the posterior can be plotted with plot_lawbl.

Usage

pefa(
  dat,
  Q = NULL,
  K = 8,
  mjf = 3,
  PPMC = FALSE,
  burn = 5000,
  iter = 5000,
  missing = NA,
  eig_eps = 1,
  sign_eps = 0,
  rfit = TRUE,
  rs = FALSE,
  update = 1000,
  rseed = 12345,
  verbose = FALSE,
  auto_stop = FALSE,
  max_conv = 10,
  digits = 4
)

Arguments

dat

A N \times J data matrix or data.frame consisting of the responses of N individuals to J items.

Q

A J \times K design matrix for the loading pattern with K factors and J items for PEFA. Elements are 1, -1, and 0 for specified, unspecified, and zero-fixed loadings, respectively. It's not needed for FEFA, which is the default. See Examples.

K

Maximum number of factors for selection under FEFA. Not used for PEFA.

mjf

Minimum number of items per factor.

PPMC

logical; TRUE for conducting posterior predictive model checking.

burn

Number of burn-in iterations before posterior sampling.

iter

Number of formal iterations for posterior sampling (> 0).

missing

Value for missing data (default is NA).

eig_eps

minimum eigenvalue for factor extraction.

sign_eps

minimum value for switch sign of loading vector.

rfit

logical; TRUE for providing relative fit (DIC, BIC, AIC).

rs

logical; TRUE for enabling recommendation system.

update

Number of iterations to update the sampling information.

rseed

An integer for the random seed.

verbose

logical; to display the sampling information every update or not.

  • Feigen: Eigenvalue for each factor.

  • NLA_lg0: Number of Loading magnitudes > 0 for each factor.

  • iShrink: Inverted shrinkage parameter for each factor.

  • True Fa: Is the factor identified as true or not.

  • EPSR & NCOV: EPSR for each factor & # of convergence.

  • ROW: LA overflow,sign switch,bk=0, <eig_eps: Loading overflow, sign switch, vector bk=0 and eigenvalue<eig_eps.

auto_stop

logical; TRUE for enabling auto stop based on EPSR.

max_conv

maximum consecutive number of convergence for auto stop.

digits

Number of significant digits to print when printing numeric values.

Value

pcfa returns an object of class lawbl without item intercepts. It contains a lot of information about the posteriors that can be summarized using summary.lawbl.

References

Chen, J. (2021). A Bayesian regularized approach to exploratory factor analysis in one step. Structural Equation Modeling: A Multidisciplinary Journal, 28(4), 518-528. DOI: 10.1080/10705511.2020.1854763.

Chen, J. (In Press). Fully and partially exploratory factor analysis with bi-level Bayesian regularization. Behavior Research Methods.

Examples


#####################################################
#  Example 1: Fully EFA                             #
#####################################################

dat <- sim18cfa0$dat

m0 <- pefa(dat = dat, K=5, burn = 2000, iter = 2000,verbose = TRUE)
summary(m0) # summarize basic information
summary(m0, what = 'qlambda') #summarize significant loadings in pattern/Q-matrix format
summary(m0, what = 'phi') #summarize factorial correlations
summary(m0, what = 'eigen') #summarize factorial eigenvalue

##########################################################
#  Example 2: PEFA with two factors partially specified  #
##########################################################

J <- ncol(dat)
K <- 5
Q<-matrix(-1,J,K);
Q[1:2,1]<-Q[7:8,2]<-1
Q

m1 <- pefa(dat = dat, Q = Q,burn = 2000, iter = 2000,verbose = TRUE)
summary(m1)
summary(m1, what = 'qlambda')
summary(m1, what = 'phi')
summary(m1,what='eigen')


LAWBL documentation built on May 16, 2022, 9:06 a.m.