Turns a unidimensional model fitted with mirt into the rows of a
questionnaire csv (see read_questionnaire): the coefficients of each
item (coef(fit, simplify = TRUE)), the mean and standard deviation of the
latent trait, and the text and answer options of the items. Fit one model per
scale, bind the tables of the scales with rbind() and save them with
write_questionnaire.
Usage
questionnaire_from_mirt(
fit,
scale,
question = NULL,
options = NULL,
key = NULL,
reverse = FALSE,
stem = NA,
public = TRUE
)Arguments
- fit
A unidimensional model fitted with
mirt::mirt(), with itemtypersm,Rasch,graded,grsm,2PL,3PL,4PLornominal.- scale
The name of the scale.
- question
The text of the items, in the order of the model; the item names when
NULL.- options
The answer options: one character vector for all the items, or a list with one vector per item, in scoring order (the lowest category first). Numbered when
NULL.- key
For dichotomous items given as several options: the number of the correct option of each item.
- reverse
TRUEfor items whose answers were reversed before the fit.- stem
An instruction shown above the items.
- public
FALSEwhen the texts of the items are not public andquestionis only a placeholder: the CAT tab then highlights the correct option of keyed items.
See also
Other questionnaire:
example_questionnaires(),
irt_models(),
read_questionnaire(),
validate_questionnaire_against_mirt(),
write_questionnaire()
Examples
if (FALSE) { # \dontrun{
fit <- mirt::mirt(responses, 1, itemtype = "graded")
q <- questionnaire_from_mirt(fit, "Anxiety",
question = c("I worry a lot", "I feel tense"),
options = c("Never", "Sometimes", "Often", "Always")
)
write_questionnaire(q, "anxiety.csv")
} # }