speed_boot_par {hmmr}R Documentation

speed boot par

Description

Example of a parametric bootstrap for paraneter inference

Usage

data("speed_boot_par")

Format

A boot object

Details

The bootstrap sample was generated by the following code:

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)

Examples

data(speed_boot_par)
# confidence intervals
confint <- apply(speed_boot_par$t,2,quantile,probs=c(.025,.975))
colnames(confint) <- c("p1","p2","m1","sd1","m2","sd2")
confint

[Package hmmr version 1.0-0 Index]