This function calculates ability estimates and diagnostics from a fitted Rasch model. It prepares the item bank, calculates the corresponding D-score and DAZ, and computes fit statistics for items and persons. It also handles equating and anchoring for the D-score transformation. Results can be returned in either the logit or in the D-score metric.

calculate_dmodel(
  data,
  fit,
  anchors = NULL,
  name = NULL,
  key = NULL,
  transform = c(`(Intercept)` = 0, original = 1),
  itemtable_from = NULL,
  relevance = c(-Inf, Inf),
  population = NULL,
  prior_mean = NULL,
  background_equate = FALSE
)

Arguments

data

A matrix or a data frame with item responses. The data can take two shapes. In the wide shape the data is a matrix or data frame with items in columns and visits in the rows. In the long shape the data is a data frame with item responses in long format, i.e. with visit identifying variables, a column with item names and a column with responses. The wide format is simpler to work with, but the long format allows for more flexibility in the data structure and is more efficient for large datasets. The responses should be coded as 1 (pass) or 0 (fail). Missing responses are allowed and are coded as NA.

fit

An object produced by rasch.

anchors

A named numeric vector of length 2. The names of the vector must correspond to two item names in data that will act as anchors to define the scale units. If specified, the function will update both tau and transform parameters. The default is anchors = NULL, which means that the tau is calculated through the transform argument.

name

If specified, the string will be appended to "number of items"_"number of equates".

key

A string with a provisional key name. If not specified, the name is used.

transform

A vector of length 2 with the intercept and slope of the linear transformation of item difficulties tau to the D-score scale. The default c(0, 1) makes all calculations in the logit scale.

itemtable_from

Location of the itemtable for the items. The default NULL selects dscore::builtin_itemtable. Setting itemtable_from to "" creates simple sequential labels. Setting itemtable_from to ddata::itemtable selects the itemtable object in the ddata package. Note that items not listed in itemtable will not ” appear in the itembank.

relevance

See dscore.

population

Name of reference to calculate DAZ: See dscore()

prior_mean

Name of prior mean column: See dscore()

background_equate

A named list or a logical. The named list has the same structure as the equate parameter. The argument specifies a list of all (active and passive) equate groups. Each element specifies a vector of item names belonging to the same equate group. Setting background_equate = TRUE calculates the parameter from dscore::builtin_itemtable. The function adds new equate groups and updates existing equate groups by the corresponding background_equate, or overwrite an existing element along the equate object for active equates. Setting background_equate = FALSE (default) does not specify any passive equates.

Value

An object of class dmodel. See details for a description of the list elements.

Examples

if (FALSE) { # \dontrun{
library("dmetric")
library("tidyr")

# test with Dutch items
varlist <- prepare_items(study = "Netherlands 1")
dmo <- fit_dmodel(varlist, name = "Dutch")
} # }