Skip to contents

Models fitted with measr are represented as a measrfit object. If a model is estimated with Stan, but not measr, a measrfit object can be created in order to access other functionality in measr (e.g., model fit, reliability).

Usage

measrfit(
  data = list(),
  type = character(),
  prior = default_dcm_priors(type = type),
  stancode = character(),
  method = character(),
  algorithm = character(),
  backend = character(),
  model = NULL,
  respondent_estimates = list(),
  fit = list(),
  criteria = list(),
  reliability = list(),
  file = NULL,
  version = list(),
  class = character()
)

Arguments

data

The data and Q-matrix used to estimate the model.

type

The type of DCM that was estimated.

prior

A measrprior object containing information on the priors used in the model.

stancode

The model code in Stan language.

method

The method used to fit the model.

algorithm

The name of the algorithm used to fit the model.

backend

The name of the backend used to fit the model.

model

The fitted Stan model. This will object of class rstan::stanfit if backend = "rstan" and CmdStanMCMC if backend = "cmdstanr" was specified when fitting the model.

respondent_estimates

An empty list for adding estimated person parameters after fitting the model.

fit

An empty list for adding model fit information after fitting the model.

criteria

An empty list for adding information criteria after fitting the model.

reliability

An empty list for adding reliability information after fitting the model.

file

Optional name of a file which the model objects was saved to or loaded from.

version

The versions of measr, Stan, rstan and/or cmdstanr that were used to fit the model.

class

Additional classes to be added (e.g., measrdcm for a diagnostic classification model).

Value

A measrfit object.

Examples

rstn_mdm_lcdm <- measr_dcm(
  data = mdm_data, missing = NA, qmatrix = mdm_qmatrix,
  resp_id = "respondent", item_id = "item", type = "lcdm",
  method = "optim", seed = 63277, backend = "rstan"
)

new_obj <- measrfit(
  data = rstn_mdm_lcdm$data,
  type = rstn_mdm_lcdm$type,
  prior = rstn_mdm_lcdm$prior,
  stancode = rstn_mdm_lcdm$stancode,
  method = rstn_mdm_lcdm$method,
  algorithm = rstn_mdm_lcdm$algorithm,
  backend = rstn_mdm_lcdm$backend,
  model = rstn_mdm_lcdm$model,
  respondent_estimates = rstn_mdm_lcdm$respondent_estimates,
  fit = rstn_mdm_lcdm$fit,
  criteria = rstn_mdm_lcdm$criteria,
  reliability = rstn_mdm_lcdm$reliability,
  file = rstn_mdm_lcdm$file,
  version = rstn_mdm_lcdm$version,
  class = "measrdcm"
)