est_flexmirt {irt} | R Documentation |
Unidimensional Item Calibration via flexMIRT
Description
est_flexmirt
runs flexMIRT in batch mode. This function
requires flexMIRT program already installed on the Windows machine.
Visit <https://vpgcentral.com/software/flexmirt/> for more details
about the software. Even though flexMIRT can run various models, only a
selected set of unidimensional models can be fitted using
est_flexmirt
function.
Usage
est_flexmirt(
x = NULL,
model = NULL,
target_dir = getwd(),
analysis_name = "flexMIRT_calibration",
item_ids = NULL,
D = 1,
max_em_cycles = c(500, 100),
quadrature = c(49, 6),
em_tol = c(1e-04, 1e-09),
prior = NULL,
gof = "Basic",
examinee_id_var = NULL,
group_var = NULL,
scoring_method = NULL,
additional_options = NULL,
additional_constraints = NULL,
flexmirt_exe = NULL,
overwrite = FALSE,
show_output_on_console = TRUE
)
Arguments
x |
A matrix/data.frame/Response_set object including examinee item responses. In it's bare form, it can be a matrix of item responses, where ideally the column names are the item IDs and row names are the examinee IDs (though neither are necessary). |
model |
The psychometric model(s) of items. The user can provide an
input in the following three ways: (a) A vector of length one which
represents the model of each item. (b) A vector which has the same length
as the number of items that will be calibrated that specifies the model
of each item. (c)
|
target_dir |
The directory/folder where the flexMIRT syntax data
files and output will be saved. The default value is the current working
directory, i.e. |
analysis_name |
This will be the file names of the data, flexMIRT
syntax file and output files. The default value is
|
item_ids |
A vector of column names or numbers of the |
D |
Scaling constant. Default value is 1. If it is not equal to 1, a new line added to constraints to multiply the slope parameter with the D value specified. |
max_em_cycles |
A numeric vector of length two specifying the maximum
number of iterations allowed in E- and M-steps. The default value is
|
quadrature |
A numeric vector of length two specifying the number of
quadrature points and the maximum theta value. The default value is
|
em_tol |
A numeric vector of length two specifying the convergence
criteria for E- and M-steps. The default value is |
prior |
A data frame that specifies the priors for the estimated item parameters. There are two possible options. Option 1: The same priors will be imposed on all items. The data.frame should have four columns:
Here is an example:
Option 2: Different priors will be assigned to individual items.
The data.frame should have five columns. In addition to four columns
described above, a column specifying item's ID should be added.
The column name should be Here is an example:
|
gof |
A string specifying the extent of Goodness-of-fit indices that
will be calculated and reported. The available options are
|
examinee_id_var |
If examinee IDs are saved in one of the columns of
argument |
group_var |
The column name or number that contains group membership
information if multi-group calibration is desired. Ideally, it grouping
variable is represented by single digit integers. If other type of data
provided, an integer value will automatically assigned to the variables.
The default value is |
scoring_method |
A string value representing the method of scoring. The currently available options are: "EAP" and "MAP". |
additional_options |
A vector of strings that will be added to the
syntax. For example, when |
additional_constraints |
The The default value is Examples of additional constraints can be:
|
flexmirt_exe |
This is the executable file to run flexMIRT syntax. On
most Windows computers this is the path where |
overwrite |
If TRUE and there is already a BILOG-MG data file in the target path with the same name, the file will be overwritten. |
show_output_on_console |
logical (not NA), indicates whether to capture
the output of the command and show it on the R console. The default value
is |
Value
A list containing the calibration results
- "ip"
An
Itempool-class
object holding the item parameters. Please check whether model converged (using...$converged
) before interpreting/usingip
.- "score"
A data frame object that holds examinee IDs, ability estimates and standard error of ability estimates.
- "syntax"
The syntax file.
- "converged"
A logical value indicating whether a model has been converged or not. This value is
TRUE
only when bothconverged_first_order
andconverged_second_order
areTRUE
.- "converged_first_order"
A logical value indicating whether first-order test indicates convergence.
- "converged_second_order"
A logical value indicating whether second-order test indicates convergence.
- "convergence_details"
A more detailed information about convergence. This element has two values, "First-order test" and "Second-order test". Use this information to further judge the convergence. From flexMIRT user manual (p.11): "the reported first-order test examines if the gradient has vanished sufficiently for the solution to be a stationary point. The second-order test tests if the information matrix is positive definite, a prerequisite for the solution to be a possible maximum. For the second-order test, reporting that the solution is a possible maximum simply means that the program reached a statistically desirable solution. The other possible message that may be printed for the outcome of the second-order test is “Solution is not a maximum; caution is advised.” If a warning message is received for either the first- or second-order test, all parameter estimates should be taken a provisional and should not be used as final estimates, for future scoring, etc. but, rather, should be used to diagnose possible issues with the model/items."
- "gof"
The goodness-of-fit statistics.
- "input"
A list object that stores the arguments that are passed to the function.
Author(s)
Emre Gonulates
Examples
## Not run:
#############################################
############## Example 1 - 2PL ##############
#############################################
# IRT Two-parameter Logistic Model Calibration
# Create responses to be used in flexMIRT estimation
true_theta <- rnorm(1000)
true_ip <- generate_ip(n = 30, model = "2PL")
resp <- sim_resp(true_ip, true_theta)
# The following line will run flexMIRT, estimate 2PL model and put the
# analysis results in the target directory:
fm_calib <- est_flexmirt(x = resp, model = "2PL",
target_dir = "C:/Temp/Analysis", overwrite = TRUE)
# Check whether the calibration converged
fm_calib$converged
fm_calib$convergence_details
# Get the estimated item pool
fm_calib$ip
# See the BILOG-MG syntax
cat(fm_calib$syntax, sep = "\n")
# Get goodness-of-fit statistics and marginal reliability:
fm_calib$gof
# Get estimated scores
head(fm_calib$score)
# Compare true and estimated abilities
plot(true_theta, fm_calib$score$theta, xlab = "True Theta",
ylab = "Estimated theta")
abline(a = 0, b = 1, col = "red", lty = 2)
# Compare true item parameters
plot(true_ip$a, fm_calib$ip$a, xlab = "True 'a'", ylab = "Estimated 'a'")
abline(a = 0, b = 1, col = "red", lty = 2)
plot(true_ip$b, fm_calib$ip$b, xlab = "True 'b'", ylab = "Estimated 'b'")
abline(a = 0, b = 1, col = "red", lty = 2)
mean(fm_calib$score$theta)
#############################################
############## Example 2 - 3PL ##############
#############################################
# IRT Three-parameter Logistic Model Calibration with D = 1.7
# Create responses to be used in flexMIRT estimation
true_theta <- rnorm(5000)
true_ip <- generate_ip(n = 35, model = "3PL", D = 1)
resp <- sim_resp(true_ip, true_theta)
# The following line will run 3PL calibration via flexMIRT:
fm_calib <- est_flexmirt(
x = resp,
model = "3PL",
max_em_cycles = c(1000, 200),
prior = data.frame(par = c("intercept", "slope", "guessing"),
dist = c("normal", "lognormal", "beta"),
v1 = c(0, 0, 1),
v2 = c(1, 0.5, 3)),
target_dir = "C:/Temp/Analysis",
overwrite = TRUE)
# Check whether the calibration converged
fm_calib$converged
fm_calib$convergence_details
# Get the estimated item pool
fm_calib$ip
# Get goodness-of-fit statistics and marginal reliability:
fm_calib$gof
# Get estimated scores
head(fm_calib$score)
# Compare true and estimated abilities
plot(true_theta, fm_calib$score$theta, xlab = "True Theta",
ylab = "Estimated theta")
abline(a = 0, b = 1, col = "red", lty = 2)
# Compare true item parameters
plot(true_ip$a, fm_calib$ip$a, xlab = "True 'a'", ylab = "Estimated 'a'")
abline(a = 0, b = 1, col = "red", lty = 2)
plot(true_ip$b, fm_calib$ip$b, xlab = "True 'b'", ylab = "Estimated 'b'")
abline(a = 0, b = 1, col = "red", lty = 2)
mean(fm_calib$score$theta)
## End(Not run) # end dontrun