Description Usage Format Details Examples
Example of a parametric bootstrap for paraneter inference
1 | data("speed_boot_par")
|
A boot
object
The bootstrap sample was generated by the following code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | require(depmixS4)
require(hmmr)
require(boot)
data(speed1)
set.seed(5)
spmix2 <- mix(RT~1, data=speed1, nstates=2)
fspmix2 <- fit(spmix2,verbose=FALSE)
# define a function to produce a bootstrap sample
speed.rg <- function(data,mle) {
simulate(data)
}
# define what to do with a sample (i.e. estimate parameters)
speed.fun <- function(data) {
getpars(fit(data,verbose=FALSE,emcontrol=
em.control(random.start=FALSE)))
}
# produce 1000 bootstrap samples (may take some time!)
speed_boot_par <- boot(fspmix2,speed.fun,R=1000,sim="parametric",
ran.gen = speed.rg)
|
1 2 3 4 5 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.