simulate.mpt | R Documentation |
Simulates responses from the distribution corresponding to a fitted
mpt
model object.
## S3 method for class 'mpt' simulate(object, nsim, seed, pool = TRUE, ...)
object |
an object of class |
nsim, seed |
currently not used. |
pool |
logical, if |
... |
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.
mpt
, rmultinom
.
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) ## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.