- 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) NULL
, the default value, where the program will
check the number of categories of each item. Items with two or fewer
categories will be calibrated using "3PL"
(three-parameter logistic
IRT model), items with more than two categories will be calibrated using
"GRM"
(Graded Response Model).
"1PL"
One-parameter logistic model.
"2PL"
Two-parameter logistic model.
"3PL"
Three-parameter logistic model.
"GRM"
Graded Response Model
"GPCM"
Generalized Partial Credit Model
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. get_wd()
.
analysis_name
This will be the file names of the data, flexMIRT
syntax file and output files. The default value is
"flexMIRT_calibration"
.
item_ids
A vector of column names or numbers of the x
that
represents the responses. The default value is NULL
where all of
the columns in the data are assumed to be a response matrix (unless
specified by group_var
or examinee_id_var
arguments).
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
c(500, 100)
where there will be maximum 500 iterations allowed in
E-steps and 100 iterations M-steps,
quadrature
A numeric vector of length two specifying the number of
quadrature points and the maximum theta value. The default value is
c(49, 6)
where there will be 49 rectangular quadrature points over
-6 and +6,
em_tol
A numeric vector of length two specifying the convergence
criteria for E- and M-steps. The default value is c(1e-4, 1e-9)
where convergence criteria for E-steps is 0.0001 and the convergence
criteria for M-step is 1e-9.
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:
"par"
The parameter on which prior will be imposed. It
can take the following values: "intercept"
for location
parameters (usually for item difficulty parameters, "slope"
for
item discrimination parameters, "guessing"
for lower asymptote
parameter of 3PL.
"dist"
The distribution of the prior. It can take the
following values: "normal"
for normal distribution,
"lognormal"
for log-normal distribution, and "beta"
for
Beta distribution.
"v1"
A number for the first parameter of the selected
distribution. For normal and log-normal distributions this is the mean
of the distribution. For Beta distribution, this is the alpha-1 value.
So, if the a Beta distribution with alpha = 10 desired, the value of
'v1' should be 11.
"v2"
A number for the second parameter of the selected
distribution. For normal and log-normal distributions this is the
standard deviation of the distribution. For Beta distribution, this is
the beta-1 value. So, if the a Beta distribution with beta = 3 desired,
the value of 'v2' should be 4.
Here is an example:
prior <- data.frame(par = c("intercept", "slope", "guessing"),
dist = c("normal", "lognormal", "beta"),
v1 = c(0, 0, 1),
v2 = c(1, 0.5, 3))
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 "item_id"
and it's values should
correspond to the item ID's specified in the response data.
Here is an example:
prior <- data.frame(
item_id = c("Item_1", "Item_1", "Item_3", "Item_3", "Item_10"),
par = c("intercept", "slope", "intercept", "slope", "slope"),
dist = c("normal", "lognormal", "normal", "lognormal", "lognormal"),
v1 = c(0, 0, 0, 0, 0),
v2 = c(1, 0.5, 2, 0.6, 0.7))
gof
A string specifying the extent of Goodness-of-fit indices that
will be calculated and reported. The available options are
"Basic"
(the default value), "Extended"
and
"Complete"
.
examinee_id_var
If examinee IDs are saved in one of the columns of
argument x
, this will be the name of that column. The default value
is NULL
. When the value is NULL
, the program will check the
row names of the data.frame or matrix. If the row names are not
NULL
, the program will use these values as examinee IDs.
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 NULL
, where no multi-group analysis will be
performed.
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 scoring_method = "ML"
, the minimum and
maximum values of theta estimates needs to be specified:
c("MinMLscore = -5;", "MaxMLscore = 5;")
. Or, when estimating "3PL"
parameters "NormalMetric3PL = Yes;"
can be added to get a normal
metric scale. See flexMIRT manual for other options.
The default value is NULL
, where no additional options will be
added to the syntax.
Note that following additional options will be added by other arguments
of this function, so you don't need to add them in this argument
separately:
"Quadrature =", "MaxE =", "MaxM =", "Etol =", "Mtol =", "Score ="
additional_constraints
The The default value is NULL
, where no
additional constraints will be added to the syntax except the constraints
that will be added for models such as "Rasch"
or "1PL"
.
Examples of additional constraints can be:
Guessing parameter. For example, if the items are multiple choice
and there are four possible choices, the prior distribution of the
pseudo-guessing parameter can be set to Beta(1, 3), where parameters
alpha = 2 (2 - 1 = 1) and beta = 4 (4-1 = 3). This will
correspond to prior sample size of 4 and prior mode of
(1 / (3+1) = 0.25). You can add the following line to the
additional_constraints
(see Example 2 below.):
Prior (Item_1-Item_35), Guessing : Beta(1.0,3.0);
The distribution can be different, for example, for Normal distribution
provide mean and standard deviation, for Log-normal distribution
provide mean and standard deviation in logarithmic scale.
For example, in the code below, a normal prior with mean -1.09 and
standard deviation 0.5 is imposed on the logit of the guessing
parameters:
Prior (Item_1-Item_35), Guessing : Normal(-1.09,0.5);
Slope parameters. The following argument will set
the item slopes for Item_1 to Item_10 equal:
Fix (Item_1-Item_10), Slope;
Similarly a log-normal prior can be imposed on slope parameters:
Prior (Item_1-Item_35), Slope : logNormal(1, 1.6487);
flexmirt_exe
This is the executable file to run flexMIRT syntax. On
most Windows computers this is the path where "WinFlexMIRT.exe"
can
be found. For example:
"C:\Program Files\flexMIRT3.5.2\WinFlexMIRT.exe"
. By default the
value is NULL
, the function will search the relevant locations for
"WinFlexMIRT.exe"
.
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 TRUE
.