lba {glba} | R Documentation |
Specify and fit lba models.
Description
Specification of lba models with explanatory variables on the parameters. Models are fitted using full information maximum likelihood.
Usage
lba(rt, response, data, weights,
sddr = ~1,
sp = ~1,
bound = ~1,
nond = ~1,
drift = ~1,
scaling = "sum",
loglink = c(FALSE, FALSE, FALSE, FALSE),
sdstart=0.1,
startpars,
fixed = NULL,
method = "L-BFGS-B",
hessian = FALSE,
lower = -Inf,
upper = Inf,
fit=TRUE,
debug=FALSE)
## S3 method for class 'lba'
logLik(object, ...)
## S3 method for class 'lba'
print(x, ...)
## S3 method for class 'lba'
summary(object, ...)
tablba(object)
Arguments
rt |
The name of the response time variable in data.frame 'data'. |
response |
The name of the response time variable in data.frame 'data'. |
data |
Data.frame containing the variables. |
weights |
Optional case weights. |
sddr |
The model for the standard deviation of the drift rate, see Details. |
sp |
The model for the start point parameter, see Details. |
bound |
The model for the boundary parameter, see Details. |
nond |
The model for the non-decision time, see Details. |
drift |
The model for the drift rate parameter, see Details. |
scaling |
Options for making the model identifiable; options are "sum" or "fixedSD". |
loglink |
Wheter parameters (sddr, sp, nond, and bound) should be fitted using a log link function (to avoid boundary estimation issues). |
sdstart |
Starting value of the standard deviation of the drift rates in case argument scaling uses option "fixedSD". |
startpars |
Vector of starting values for the parameters. This is currently a required argument as no automatic starting values are available. |
fixed |
Logical; when startpars is given 'fixed' can be used to specify whether parameters should remain fixed during estimation; sometimes required for more stable estimation. |
method |
Optimization method; passed to optim. |
hessian |
Logical; indicating whether the estimated hessian at the minimum; passed to optim. |
lower , upper |
lower and upper boundaries for the parameters; only applicable with optimization method 'L-BFGS-B' is used. |
fit |
Logical; indicating whehter the model should be fit, ie, its parameters optimized or not. Default is TRUE. |
debug |
Logical, default is FALSE; prints out detailed information on submodels, parameters et cetera during optimization. |
object |
a (fitted) lba model. |
x |
a (fitted) lba model. |
... |
not currently in use. |
Details
The 5 sub-models of the LBA model can be specified using a formula. Eg,
nond=~diff
, specifies a model in which the nond
ecision time
is modeled as function of diff
iculty; diff
may be a factor or
numerical variable.
Identification of the model is attained by having the drift rates for
alternatives in response
sum to unity or by having a fixed standard
deviation of the drift rates. These options are specified by scaling="sum"
or scaling="fixedSD", respectively. In the latter case, the value of the
fixed standard deviation is assumed to be the first value of
startpars
.
If hessian
is set to TRUE, optim
is used to get the Hessian
at the maximum likelihood estimates of the parameters. This is used in
turn to compute standard errors. The summary
function pretty prints
a table of parameter estimates, standard errors, z- and p-values. The
summary
function also prints the separate sub-model specifications
and the parameter estimates. The print
function prints basic
information and a (named) vector of parameter estimates.
Value
The lba
function returns a list with the following components:
pars |
The values of fitted parameters. |
logl |
The optimized log likelihood |
convergence |
Convergence information from |
hessian |
Only included if |
ses |
Only included if |
fixed |
Vector of logical's indicating whether parameters were fixed |
model |
List of 5 sub-models of the LBA model, see Details above. |
npar |
The number of parameters of the model |
freepars |
The number of freely estimated parameters of the model |
nobs |
The number of observations, used in computing the BIC |
call |
The (matched) call to the |
Function tablba
returns a data.frame
with columns:
value |
The estimated (or fixed) parameter value |
se |
The standard error of the parameter computed from the Hessian |
z |
The z-ratio of |
p |
The p-value associated with |
Author(s)
Ingmar Visser
References
LBA models as in Brown and Heathcote, Cognitive science, 2008.
Examples
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)
## End(Not run)