# NOT RUN {
data(bh08)
# reduce the data set for faster runtimes
bh1 <- bh08[c(1:300,1001:1300,2001:2300),]
# remove extreme RTs
bh1 <- bh1[bh1$rt>.180&bh1$rt<2,]
# starting values based on the quantile parameter
# estimates from Brown and Heathcote, 2008:
# pars <- c(.25,.3,.1,.2,.9,.75,.6)
# fit the model with starting values
pars <- c(.25,.3,.1,.2,.9,.75,.6)
m1 <- lba(rt=rt,response=acc,drift=~diff-1,data=bh1,
startpars=pars)
m1
summary(m1)
# }
# NOT RUN {
# use random starting values instead
set.seed(2)
m1 <- lba(rt=rt,response=acc,drift=~diff-1,data=bh08,
startpars=pars, hessian=TRUE)
summary(m1)
# get the parameters
pp <- m1$pars
# simulate some data from the model for the three conditions
set.seed(1)
dt1 <- rlba(1000, b=pp[3]+pp[2], A=pp[2], vs=c(pp[5],1-pp[5]),
s=pp[1], t0=pp[4], truncdrifts=TRUE)
dt2 <- rlba(1000, b=pp[3]+pp[2], A=pp[2], vs=c(pp[6],1-pp[6]),
s=pp[1], t0=pp[4], truncdrifts=TRUE)
dt3 <- rlba(1000, b=pp[3]+pp[2], A=pp[2], vs=c(pp[7],1-pp[7]),
s=pp[1], t0=pp[4], truncdrifts=TRUE)
dt <- rbind(dt1,dt2,dt3)
dt$diff <- gl(3,1000)
dt$resp <- ifelse(dt$resp==2,0,1)
# remove extreme RTs
dt <- dt[dt$rt>.180&dt$rt<2,]
# refit the model with the simualted data
m1rf <- lba(rt=rt,response=resp,drift=~diff-1,data=dt,startpars=pp)
data(numpp1)
set.seed(9)
m2 <- lba(rt=rt,response=acc,drift=~diff+block,data=numpp1,
startpars=c(0.25,runif(4),0,0), scaling="fixedSD",
sdstart=0.25, hessian=TRUE)
tablba(m2)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab