View source: R/shape_df_fipc.R
| shape_df_fipc | R Documentation |
This function merges existing fixed-item metadata with automatically
generated metadata for new items, producing a single data frame ordered by
specified test positions, to facilitate fixed item parameter calibration
using est_irt().
shape_df_fipc(x, fix.loc = NULL, item.id = NULL, cats, model)
x |
A data.frame of metadata for items whose parameters remain fixed
(e.g., output from |
fix.loc |
An integer vector specifying the row positions in the final output where fixed items should be placed. |
item.id |
A character vector of IDs for new items whose parameters will
be estimated.If |
cats |
An integer vector indicating the number of response categories
for each new item; order must match |
model |
A character vector of IRT model names for each new item. Valid options for dichotomous items: "1PLM", "2PLM", "3PLM", "DRM"; for polytomous items: "GRM", "GPCM". |
To use this function, first prepare a metadata frame x containing
only fixed items - either created by shape_df() or imported from
external software (e.g., via bring.flexmirt()), which must include
columns id, cats, model, and all relevant parameter columns (par.1,
par.2, etc.). The fix.loc argument should then specify the exact row
positions in the final test form where these fixed items should remain. The
length of fix.loc must match the number of rows in x, and the order of
positions in fix.loc determines where each fixed-item row is placed.
Next, provide information for the new items whose parameters will be
estimated. Supply vectors for item.id, cats, and model matching the
number of new items (equal to total form length minus length of fix.loc).
If item.id is NULL, unique IDs are generated automatically.
A data.frame containing combined metadata for all items (fixed and new), ordered by test position.
Hwanggyu Lim hglim83@gmail.com
shape_df()
## Import the flexMIRT parameter output file
prm_file <- system.file("extdata", "flexmirt_sample-prm.txt", package = "irtQ")
x_fixed <- bring.flexmirt(file = prm_file, "par")$Group1$full_df
## Define positions of fixed items in the test form
fixed_pos <- c(1:40, 43:57)
## Specify IDs, models, and category counts for new items
new_ids <- paste0("NI", 1:6)
new_models <- c("3PLM", "1PLM", "2PLM", "GRM", "GRM", "GPCM")
new_cats <- c(2, 2, 2, 4, 5, 6)
## Generate combined metadata for FIPC
shape_df_fipc(x = x_fixed, fix.loc = fixed_pos, item.id = new_ids,
cats = new_cats, model = new_models)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.