spfa {spfa}R Documentation

Fitting Semi-parametric Factor Analysis Model

Description

spfa fits a unidimensional or two-dimension factor analysis spfa model using penalized maximum likelihood estimation. A unidimensional spfa model can handle discrete response data (i.e., item responses including binary responses and polytomous responses) or continuous response data (e.g., response time). A two-dimensional spfa model can only handle simple structure model with two latent factors load to continuous and discrete response data, respectively.

Usage

spfa(
  data,
  dimension = rep(0, ncol(data)),
  discrete = rep(FALSE, ncol(data)),
  control = list()
)

Arguments

data

a matrix that consists of item responses with missing data coded as NA.

dimension

a vector of integers containing indicators of the latent factor. The default is rep(0, ncol(data)) indicating all item load on the same latent factor.

discrete

a vector of TRUE or FALSE indicating whether the item is discrete. TRUE: discrete variable. The length of the vector should be the same as the number of columns of the input data.

control

a list containing technical parameters for estimation. May be:

  • shortpar a list containing the starting values of spfa model parameters for each item.

  • pos a list containing positivity constraints

  • lmbd a vector of the penalty parameter (lambda). Default value is a vector of 1s.

  • n_basis number of basis. Default is 11.

  • n_quad number of quadrature points. Default is 21

  • maxit_em the maximum number of iterations for the EM cycles. Default is 500.

  • maxit_mstep the maximum number of iterations for the mstep optimizer.

  • maxit_start

  • tol_em tolerance for the EM convergence. Default is 1e-4.

  • tol_mstep tolerance for the m-step optimizer. Default is 1e-6.

  • n_thrd number of cores used for the penalized EM algorithm to run. Default is 1.

Value

a list including spfa model parameter estimates and marginal log-likelihood.

References

Liu, Y., & Wang, W. (2022). Semiparametric Factor Analysis for Item-Level Response Time Data. Psychometrika, 87(2), 666–692. doi:10.1007/s11336-021-09832-8

Liu, Y., & Wang, W. (2023). What Can We Learn from a Semiparametric Factor Analysis of Item Responses and Response Time? An Illustration with the PISA 2015 Data. Retrieved from https://arxiv.org/abs/2303.10079

Examples

 # load item response time data 
 RT <- spfa::simdata[,1:8]
 
 # Fit a unidimensional spfa model with continuous data (Response time)


 
spfa_example <- spfa(data = RT, 
       dimension = rep(0, ncol(RT)), 
       discrete = rep(FALSE, ncol(RT)))
       
 
 # In the spfa pacakge, the output of spfa_example can be directly extracted. 
 # See example code below:
 
 spfa::spfa_example$shortpar
 
 # Visualize the result for item 1 as an example 
 
 plotitem.cont(spfa::spfa_example$par[[1]])

[Package spfa version 1.0 Index]