simulate.mpt.Rd
Simulates responses from the distribution corresponding to a fitted
mpt
model object.
# S3 method for class 'mpt'
simulate(object, nsim, seed, pool = TRUE, ...)
an object of class mpt
, typically the result of a
call to mpt
.
currently not used.
logical, if TRUE
(default), pooled responses (summed
across respondents) are returned.
further arguments passed to or from other methods. None are used in this method.
Responses are simulated by (repeatedly) applying rmultinom
with sizes taken from the original sample and probabilities computed from
the model object.
A named vector of (pooled) responses. Names identify the tree from which responses were simulated.
data(retroact)
m <- mpt(mptspec(
c*r,
(1 - c)*u^2,
2*(1 - c)*u*(1 - u),
c*(1 - r) + (1 - c)*(1 - u)^2,
u,
1 - u
), retroact[retroact$lists == 1, ])
simulate(m)
#> 3.1 3.2 3.3 3.4 4.1 4.2
#> 67 5 5 73 24 51
## Parametric bootstrap of goodness-of-fit test
LR.stat <- replicate(200, deviance(mpt(m$spec, simulate(m))))
hist(LR.stat, border="white", freq=FALSE, breaks=20,
main="Parametric bootstrap")
curve(dchisq(x, df=1), add=TRUE)
abline(v=deviance(m), lty=2)