Skip to contents

This function fits an Item Response Theory (IRT) model using Stan.

Usage

fit_itm(
  df_simplex,
  id_person,
  id_item,
  item_labels = NULL,
  link = "ilr",
  iter_sampling = 500,
  iter_warmup = 500,
  n_chains = 4,
  n_cores = 1,
  adapt_delta = 0.9,
  ...
)

Arguments

df_simplex

A dataframe containing the simplex data.

id_person

A vector of person indices.

id_item

A vector of item indices.

item_labels

A vector of item labels. Can be long format matching id_item or a vector of unique labels in ascending order. Default is NULL.

A character string specifying the link function. The only option as of now is "ilr", the Isometric Log-Ratio function.

iter_sampling

An integer specifying the number of sampling iterations. Default is 500.

iter_warmup

An integer specifying the number of warmup iterations. Default is 500.

n_chains

An integer specifying the number of Markov chains. Default is 4.

n_cores

An integer specifying the number of cores to use. Default is 1.

adapt_delta

A numeric value specifying the target acceptance rate. Default is 0.9.

...

Additional arguments passed to the rstan::sampling function.

Value

A fitted Stan model object.

Examples

if (FALSE) { # \dontrun{
df_simplex <- data.frame(matrix(runif(100), nrow=10))
id_person <- rep(1:5, each=2)
id_item <- rep(1:2, times=5)
fit <- fit_itm(df_simplex, id_person, id_item)
} # }