EZ2batch: Batch EZ2 model fitting

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

Fit the a simplified diffusion model for response time and accuracy in batch to each row of a data frame.

Usage

1
2
EZ2batch(pstart, ObsValPair, ..., data, nrestart = 1, method = "Nelder-Mead", 
  control = list(), hessian = FALSE)

Arguments

pstart

Numeric vector with named elements. Starting point.

ObsValPair

Formula or list of formulas relating observed value(s) to parameters. See examples below.

...

More formulas.

data

Data frame with observed values.

nrestart

Number of times the fitting should restarted. Defaults to 1.

method

See method parameter of optim.

control

See control parameter of optim.

hessian

See hessian parameter of optim.

Details

The number of restarts needs to be increased if the model entails the same number of estimated parameters as the number of modeled moments and any of the values in the value column in the returned data frame is not close to 1.0e-08.

An important bug to note: for EZbatch to fit the rows in the provided data.frame there should be no variables in the global environment with the same name as the column names of the data.frame.

Value

Data frame with parameter estimates and convergence information.

Author(s)

Raoul P. P. P. Grasman

References

Ratcliff, R. (1978). Theory of Memory Retrieval. Psychological review vol. 85 (2) pp. 59-108

Grasman, R. P. P., Wagenmakers, E.-J., & van der Maas, H. L. J. (2007). On the mean and variance of response times under the diffusion model with an application to parameter estimation, J. Math. Psych. 53: 55–68.

See Also

EZ2

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
## create some data (theoretical values, not simulated)
## Needless to say, in reality you would like to fit real data!
A = seq(.08,.13,len=6)
X2 = data.frame(A=A)
X2$vrt0 = sapply(A, function(a) EZ2.vrt(.1,.05,a))
X2$pe0 = sapply(A, function(a) EZ2.pe(.1,.05,a))
X2$vrt1 = sapply(A, function(a) EZ2.vrt(.2,a-.05,a))
X2$pe1 = sapply(A, function(a) EZ2.pe(.2,a-.05,a))

X2 = as.data.frame(X2)          # now pretend that X2 is the data frame that 
                                # you may have computed from real data

## fit an EZ2 model to each row
#  method 1:
EZ2batch(c(v0=.11,v1=.21,z=.05,a=.09), 
 vrt0 ~ EZ2.vrt(v0,z,a), 
  pe0 ~ EZ2.pe(v0,z,a), 
 vrt1 ~ EZ2.vrt(v1,a-z,a), 
  pe1 ~ EZ2.pe(v1, a-z, a), data=X2)

# method 2 (eventually less typing):
mdl <- list( vrt0 ~ EZ2.vrt(v0,z,a), 
              pe0 ~ EZ2.pe(v0,z,a), 
             vrt1 ~ EZ2.vrt(v1,a-z,a), 
              pe1 ~ EZ2.pe(v1, a-z, a)
           )
EZ2batch(c(v0=.11,v1=.21,z=.05,a=.09), mdl, data=X2)

EZ2 documentation built on May 2, 2019, 6:20 p.m.