Learn R Programming

hmmr (version 1.0-0)

speed_boot_par: speed boot par

Description

Example of a parametric bootstrap for paraneter inference

Usage

data("speed_boot_par")

Arguments

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

Run this code
# NOT RUN {
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
# }

Run the code above in your browser using DataLab