speed_boot_par: speed boot par

Description Usage Format Details Examples

Description

Example of a parametric bootstrap for paraneter inference

Usage

1
data("speed_boot_par")

Format

A boot object

Details

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)

Examples

1
2
3
4
5
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

hmmr documentation built on May 27, 2021, 9:10 a.m.

Related to speed_boot_par in hmmr...