This function runs flexMIRT (Cai, 2017) from within R by executing a model specified in a flexMIRT syntax file (i.e., *.flexmirt). To use this function, the flexMIRT software must be installed on your system. This interface is especially useful for conducting simulation studies or automating batch analyses involving flexMIRT.
Arguments
- file.syntax
A single string or character vector specifying the path(s) to one or more flexMIRT syntax files (with extension *.flexmirt) to be executed. For example:
"C:/Users/Data/irtmodel.flexmirt".- dir.flex
A character string specifying the directory where flexMIRT is installed. The folder name typically includes "flexMIRT" (e.g., "flexMIRT3", "flexMIRT 3.6"). If set to
NULL, the function searches for flexMIRT in"C:/Program Files"and uses a default path if found (e.g.,"C:/Program Files/flexMIRT3").- show.output.on.console
Logical. If
TRUE, the output of the system command is printed to the R console. Default isFALSE. Seebase::system().- ...
Additional arguments passed to
base::system().
Details
When using a version of flexMIRT earlier than 3.6, the directory
specified in dir.flex must contain the following six files:
WinFlexMIRT.exeFlexMIRT_x64.exeFlexMIRT_x86.exevpg.dllvpg.licensing.client.dllvpg.licensing.dll
For flexMIRT version 3.6 or later, the directory must include the following five files:
WinFlexMIRT.exevpg.dllvpg.licensing.client.dllvpg.licensing.dllVPGLicenseClientNet.dll
along with a subdirectory named Resources that contains the
following two files:
flexMIRT_x64_AVX.exeflexMIRT_x86_AVX.exe
References
Cai, L. (2017). flexMIRT 3.5 Flexible multilevel multidimensional item analysis and test scoring (Computer Software). Chapel Hill, NC: Vector Psychometric Group.
Author
Hwanggyu Lim hglim83@gmail.com
Examples
# Examples below will run if the flexMIRT software is installed
# in the default directory "C:/Program Files/flexMIRT3".
# Otherwise, specify the directory where flexMIRT is installed
# using the 'dir.flex' argument.
if (FALSE) { # \dontrun{
# (1) Run a single syntax file
# Load an example flexMIRT syntax file for estimating item parameters using the 2PL model
file.syntax <- system.file("extdata", "2PLM_example.flexmirt", package = "irtQ")
# Run flexMIRT to estimate item parameters for the 2PL model
run_flexmirt(file.syntax = file.syntax, dir.flex = NULL, show.output = TRUE)
# Check the output file
out.file <- system.file("extdata", "2PLM_example-prm.txt", package = "irtQ")
bring.flexmirt(out.file, type = "par")
# (2) Run multiple syntax files
# Load two example flexMIRT syntax files
file.syntax1 <- system.file("extdata", "2PLM_example.flexmirt", package = "irtQ")
file.syntax2 <- system.file("extdata", "3PLM_example.flexmirt", package = "irtQ")
# Run flexMIRT to estimate item parameters for both models
run_flexmirt(file.syntax = c(file.syntax1, file.syntax2), dir.flex = NULL, show.output = FALSE)
# Check the output files
out.file1 <- system.file("extdata", "2PLM_example-prm.txt", package = "irtQ")
out.file2 <- system.file("extdata", "3PLM_example-prm.txt", package = "irtQ")
bring.flexmirt(out.file1, type = "par")
bring.flexmirt(out.file2, type = "par")
} # }
