This function generates data from gen_model
, subsequently fits all the
models in fit_model
, and returns the results and/or saves them to an
external RData file.
irtree_sim1(
R = 1,
gen_model = NULL,
fit_model = gen_model,
N = NULL,
sigma = NULL,
itempar = NULL,
link = c("logit", "probit"),
na_okay = TRUE,
engine = c("mirt", "mplus", "tam"),
verbose = TRUE,
control = NULL,
improper_okay = FALSE,
par_type = "difficulty",
file = NULL,
dir = tempdir(),
save_rdata = FALSE,
reduce_output = FALSE
)
Integer used to number the saved output if save_rdata = TRUE
.
Really only useful when used from irtree_sim()
.
Object of class irtree_model
describing the
data-generating model. See irtree_model for more information.
Object of class irtree_model
describing the model that
should be fit to the data. May be a list of multiple objects of class
irtree_model
if different models should be fit to the same data set. See
irtree_model for more information.
Integer, the number of persons.
Either a matrix or a function that returns a matrix. This matrix
is the variance-covariance matrix of the person parameters that is passed
to MASS::mvrnorm()
. Note that the order of the person
parameters is taken from the section Processes in the model object
(see
irtree_model).
Either a list or a function that returns a list. The list has
an element beta
and an element alpha
. Each of these is a
matrix of item parameters. Note that the order of items (rows) is taken from the
section Items and the order of processes (columns) is taken from the
section Processes in the model
(see irtree_model).
Character. Link function to use.
Logical indicating whether variables with unobserved response
categories are permitted. If FALSE
, rejection sampling
is used to ensure that all categories are observed.
String specifying whether to use mirt, Mplus, or TAM for estimation.
Logical indicating whether output should be printed to the console.
List. The allowed elements of this list depend on the
engine
. Use control_mirt()
, control_mplus()
, or control_tam()
for
convenience. Note that the fit()
function does not use ...
, but that
you can use the control_*()
functions to pass additional arguments.
Logical indicating whether the model should also be fit
if it is not a proper IR-tree model. Set this only to TRUE
if you really
know what you are doing.
Only used if the fit engine was mirt. Item parameters (or
thresholds) can be either of type easiness
(the mirt default) or
difficulty
(as in Mplus and TAM).
String giving the file path used to save the output if
save_rdata = TRUE
. Note that the file ending is automatically set to
.rda
. This argument is also passed to irtree_fit_mplus()
if applicable.
Path name that is used to save the results of every run if
save_rdata = TRUE
.
Logical indicating whether to save the results to an RData file.
Logical indicating whether the returned object should be
reduced (i.e., the output of fit()
is removed and
only summary information is retained).
List with two elements. The second element spec
contains various
arguments (such as the data). The first element fits
is a list with one
element for each fit_model
that contains the output of
fit()
as well as the elements glanced
, tidied
,
and augmented
(see glance()
, tidy()
, and augment()
).
irtree_sim()
, and the wrapped functions
fit()
and irtree_gen_data()
.