EZ2batch                 package:EZ2                 R Documentation

_B_a_t_c_h _E_Z_2 _m_o_d_e_l _f_i_t_t_i_n_g

_D_e_s_c_r_i_p_t_i_o_n:

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

_U_s_a_g_e:

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

_A_r_g_u_m_e_n_t_s:

  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'. 

_D_e_t_a_i_l_s:

     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._

_V_a_l_u_e:

     Data frame with parameter estimates and convergence information.

_A_u_t_h_o_r(_s):

     Raoul Grasman

_R_e_f_e_r_e_n_c_e_s:

     Grasman, Wagenmakers, and van der Maas (2008) EZ2: An extention of
     the EZ-diffusion model for Response Time and Accuracy, _Manuscript
     submitted for publication in J. Math. Psych._

_S_e_e _A_l_s_o:

     'EZ2'

_E_x_a_m_p_l_e_s:

     ## create some data (theoretical values, not simulated)
     ## 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 on 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)

