simulate.blim.Rd
Simulates 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 00101 00110 01000 01001 01010 01100 01101 01110 01111
#> 84 6 3 8 1 1 97 7 16 15 12 13 15
#> 10000 10001 10010 10100 10101 10110 10111 11000 11001 11010 11011 11100 11101
#> 111 8 19 8 12 11 16 63 8 79 9 69 92
#> 11110 11111
#> 103 114
## 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.