% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/simulate.R
\name{sim_replicate}
\alias{sim_replicate}
\title{Replicate a simulation for Monte Carlo studies}
\usage{
sim_replicate(FUN, n, ..., seed = NULL)
}
\arguments{
\item{FUN}{A simulator, e.g. \code{\link{simulate_rasch}}.}

\item{n}{Number of datasets.}

\item{...}{Arguments passed to \code{FUN} (the same each replicate).}

\item{seed}{Seed of the first replicate (each subsequent one increments it).}
}
\value{
A list of class \code{"rasch_sim_batch"}, one simulated dataset per
  element.
}
\description{
Calls one of the \code{simulate_*} functions \code{n} times with successive
seeds, returning the datasets as a list -- for power, Type-I, or
parameter-recovery studies.
}
\examples{
# 20 datasets with a planted DIF item; how often is it flagged?
batch <- sim_replicate(simulate_rasch, 20, n_persons = 400, n_items = 10,
                       dif = list(items = "I05", uniform = 0.8), n_groups = 2,
                       seed = 1)
mean(vapply(batch, function(d)
  dif_anova(rasch(d, id = "id", factors = "group"))$summary$uniform_DIF[5], TRUE))
}
