% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/simulate.R
\name{simulate_mfrm}
\alias{simulate_mfrm}
\title{Simulate many-facet (rated) data with dial-in misfit}
\usage{
simulate_mfrm(
  n_persons = 80,
  n_items = 5,
  n_raters = 6,
  n_categories = 4,
  theta_sd = 1.2,
  item_sd = 1,
  rater_severity_sd = 0.6,
  erratic_raters = 0,
  interaction = NULL,
  halo = 0,
  seed = NULL
)
}
\arguments{
\item{n_persons, n_items, n_raters}{Facet sizes (fully crossed).}

\item{n_categories}{Rating categories.}

\item{theta_sd, item_sd}{Spread of person ability and item difficulty.}

\item{rater_severity_sd}{Spread of rater severities (the core facet;
recovered in \code{facet_effects}).}

\item{erratic_raters}{Proportion of raters who rate at random (feeds the
rater fit residual).}

\item{interaction}{\code{NULL}, or \code{list(rater=, item=, bias=)}: one
rater is unusually harsh (positive) or lenient (negative) on one item.
Feeds the item-by-rater interaction (fit with \code{interaction = }).}

\item{halo}{Proportion of raters showing a halo effect: they rate by the
person's overall level and barely differentiate items (feeds the rater
fit residual and the item-by-rater interaction).}

\item{seed}{Optional RNG seed.}
}
\value{
A long data frame of class \code{"rasch_sim"} (\code{person},
  \code{item}, \code{rater}, \code{score}) ready for
  \code{\link{rasch_mfrm}}, with the truth attached.
}
\description{
Generates ratings from the many-facet Rasch model (Linacre 1989): every
rater rates every person on every item, from person ability, item
difficulty, and rater severity. Departures each feed an MFRM diagnostic.
}
\examples{
d <- simulate_mfrm(60, 5, 6, rater_severity_sd = 0.8, seed = 1)
mf <- rasch_mfrm(d, person = "person", item = "item", score = "score",
                 facets = "rater")
cor(mf$facet_effects$rater$severity, attr(d, "truth")$severity)  # recovered
}
