simulate.blim | R Documentation |
Simulates responses from the distribution corresponding to a fitted
blim
model object.
## S3 method for class 'blim'
simulate(object, nsim = 1, seed = NULL, ...)
object |
an object of class |
nsim |
currently not used. |
seed |
currently not used. |
... |
further arguments passed to or from other methods. None are used in this method. |
Responses are simulated in two steps: First, a knowledge state is drawn
with probability P.K
. Second, responses are generated by applying
rbinom
with probabilities computed from the model
object's beta
and eta
components.
A named vector of frequencies of response patterns.
blim
, endm
.
data(DoignonFalmagne7)
blim1 <- blim(DoignonFalmagne7$K, DoignonFalmagne7$N.R)
simulate(blim1)
## Parametric bootstrap
disc <- replicate(200, blim(blim1$K, simulate(blim1))$discrepancy)
hist(disc, col = "lightgray", border = "white", freq = FALSE, breaks = 20,
main = "Parametric bootstrap", xlim = c(.05, .3))
abline(v = blim1$discrepancy, lty = 2)
## Parameter recovery for the SLM
m0 <- list( P.K = pks:::getSlmPK(g = rep(.8, 5),
K = DoignonFalmagne7$K,
Kof = pks:::getKOfringe(DoignonFalmagne7$K)),
beta = rep(.1, 5),
eta = rep(.1, 5),
K = DoignonFalmagne7$K,
ntotal = 800)
class(m0) <- c("slm", "blim")
out <- replicate(20,
coef(slm(DoignonFalmagne7$K, simulate(m0), method = "ML"))
)
boxplot(t(out), horizontal = TRUE, las = 1,
main = "SLM parameter recovery")
## See ?endm for further examples.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.