simulate.blim.RdSimulates responses from the distribution corresponding to a fitted
blim model object.
# S3 method for class 'blim'
simulate(object, nsim = 1, seed = NULL, ...)an object of class blim, typically the result of a
call to blim.
currently not used.
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.
data(DoignonFalmagne7)
m1 <- blim(DoignonFalmagne7$K, DoignonFalmagne7$N.R)
simulate(m1)
#> 00000 00001 00010 00100 00110 00111 01000 01001 01010 01011 01100 01101 01110
#> 95 5 6 2 1 2 85 11 15 2 9 8 10
#> 01111 10000 10001 10010 10011 10100 10101 10110 10111 11000 11001 11010 11011
#> 10 106 12 10 1 14 12 7 11 64 8 91 9
#> 11100 11101 11110 11111
#> 84 93 98 119
## Parametric bootstrap for the BLIM
disc <- replicate(200, blim(m1$K, simulate(m1))$discrepancy)
hist(disc, col = "lightgray", border = "white", freq = FALSE, breaks = 20,
main = "BLIM parametric bootstrap", xlim = c(.05, .3))
abline(v = m1$discrepancy, lty = 2)
## Parameter recovery for the SLM
m0 <- list( P.K = getSlmPK( g = rep(.8, 5),
K = DoignonFalmagne7$K,
Ko = getKFringe(DoignonFalmagne7$K)),
beta = rep(.1, 5),
eta = rep(.1, 5),
K = DoignonFalmagne7$K,
ntotal = 800)
class(m0) <- c("slm", "blim")
pars <- replicate(20, coef(slm(m0$K, simulate(m0), method = "ML")))
boxplot(t(pars), horizontal = TRUE, las = 1,
main = "SLM parameter recovery")
## See ?endm for further examples.