Analysis of RT distributions with R Emil Ratko-Dehnert WS 2010/ 2011 Session 10 – 25.01.2011 Last time... • RT distributions in the field – Convolution – Ex-Gaussian, Ex-Wald, Gamma, Weibull – Comparing functional fits • Bootstrapping • Creating functions in R 2 Ex-Gauss distribution Ex-Gauss • Very good fits to RT data 0.10 0.05 response processes) 0.00 gauss -> residual perceptual/ y5 • Correspondance to mental 0.15 0.20 and a gaussian distribution processes (exp -> decision, exg(mu=0, sigma=1.5, nu=0.5) exg(mu=0, sigma=1.5, nu=1) exg(mu=0, sigma=1.5, nu=2) exg(mu=0, sigma=1.5, nu=5) exg(mu=0, sigma=1.5, nu=9) 0.25 • Convolution of an exponential 0.30 Manipulating exponential parameter -4 -2 0 2 4 xx 6 8 10 3 Ex-Wald distribution Ex-Wald • Is the convolution of a Wald and an exponential distribution • Represents decision and response components as a diffusion process (Schwarz, 2001) • Neurally plausible (single cell recordings) + parameters can be interpreted psychologically • Very good fits to RT data and highly successful in modelling RTs in various cognitive fields 4 Diffusion Process Ex-Wald Information space Respond „A“ A Mean drift ν Evidence time B drift rate ~N(ν,η) Boundary separation z Respond „B“ 5 Gamma distribution • Series of exponential 0.5 Gamma densities distributions • Suitable for three-stage exponential models 0.1 0.2 y1 0.0 • Above average fits 0.3 processes, β = reflects processes gamma(shape = 1, scale = 2) gamma(shape = 2, scale = 2) gamma(shape = 3, scale = 2) gamma(shape = 5, scale = 1) gamma(shape = 9, scale = 0.5) 0.4 • α = average scale of approximate number of Gamma 0 2 4 6 xx 8 10 12 6 Weibull Distribution • Like a series of races the weibull(shape = 1, scale = 1) weibull(shape = 1, scale = 2) weibull(shape = 1.5, scale = 1) weibull(shape = 2, scale = 2) weibull(shape = 2, scale = 3) weibull(shape = 3.6, scale = 3) 0.8 an asymptotic description 1.0 Weibull densities weibull distribution renders 0.4 y1 0.6 of their minima • γ should lie between 1 (exp.) Weibull appropriate for processes which can be modelled as 0.0 • Decent functional fits, 0.2 and 3.6 (gauss.) 0 1 2 3 4 5 6 7 xx races 7 Palmer et al. (2009) • Compared functional fits for three different search tasks (feature, conjunction, spatial config.) • H0: fit to normal distribution • All proposed distributions could reject H0, but not equally well 1: Ex-Gauss, 2: Ex-Wald, 3: Gamma, 4:Weibull 8 II FUNCTIONAL FORMS OF RANDOM VARIABLES 9 So far... • We looked at densities and (cumulative) distribution functions for analysis of RTs • As all densities for RTs are unimodal and rightskewed they can be inappropriate for analysis • Similarly all CDF are sigmoidal, so they might not be adequate to compare 10 RTs in ms 11 1.0 Survivor function of Ex-Gauss distributions z5 0.4 0.2 0.0 Survivor function 0.6 0.8 exg(mu=0, sigma=1.5, nu=0.5) exg(mu=0, sigma=1.5, nu=1) exg(mu=0, sigma=1.5, nu=2) exg(mu=0, sigma=1.5, nu=5) exg(mu=0, sigma=1.5, nu=9) 0 5 10 xx • The survivor function F(t) is the probability that the lifetime of an object is at least t • In oder words: the probability that failure occurs after t F (t ) P( RT t ) 1 F (t ) 12 15 1.0 0.8 0.2 0.4 1.0 0.6 Survivor function of Ex-Gauss distributions exg(mu=0, sigma=1.5, nu=0.5) exg(mu=0, sigma=1.5, nu=1) exg(mu=0, sigma=1.5, nu=2) exg(mu=0, sigma=1.5, nu=5) exg(mu=0, sigma=1.5, nu=9) 0.0 0.8 exg(mu=0, sigma=1.5, nu=0.5) exg(mu=0, sigma=1.5, nu=1) exg(mu=0, sigma=1.5, nu=2) exg(mu=0, sigma=1.5, nu=5) exg(mu=0, sigma=1.5, nu=9) 5 10 15 0.6 xx 0.0 0.2 0.4 z5 0 0 5 10 15 13 0.2 0.4 y1 exg(mu=0, sigma=1, nu=1) exg(mu=0, sigma=0.5, nu=1) exg(mu=0, sigma=1, nu=1) exg(mu=0, sigma=0.5, nu=1) 0.0 Hazard function 0.6 0.8 1.0 Comparing Ex-Gauss CDF and hazard function -2 0 2 4 xx • The hazard function h(t) gives the likelihood that an event will occur in the next small interval dt in time, given that it has not occured before that point in time • Thus, it is the conditional probability: f (t ) h(t ) lim P(t RT t dt | RT t ) / dt dt 0 F (t ) 14 6 0.2 0.4 y1 exg(mu=0, sigma=1, nu=1) exg(mu=0, sigma=0.5, nu=1) exg(mu=0, sigma=1, nu=1) exg(mu=0, sigma=0.5, nu=1) 0.0 Connection to survivor function 0.6 0.8 1.0 Comparing Ex-Gauss CDF and hazard function -2 0 2 4 xx • When F(t) is differentiable, the hazard function can be expressed as a function of the survivor function F(t): d h(t ) ln F (t ) dt 15 6 Ex: h(t) of Ex-Gauss and Wald 16 0.6 0.8 1.0 Comparing Ex-Gauss CDF and hazard function 0.2 0.4 y1 exg(mu=0, sigma=1, nu=1) exg(mu=0, sigma=0.5, nu=1) 0.0 exg(mu=0, sigma=1, nu=1) exg(mu=0, sigma=0.5, nu=1) -2 0 2 4 6 17 0.6 0.4 y1 exg(mu=0, sigma=1, nu=1) exg(mu=0, sigma=0.5, nu=1) 0.2 Cumulative Hazard Function 0.8 1.0 Comparing Ex-Gauss CDF and hazard function 0.0 exg(mu=0, sigma=1, nu=1) exg(mu=0, sigma=0.5, nu=1) • Accumulted hazard over time H (t ) t 0 -2 0 2 4 xx h(u) du • Is an alternative (but equivalent) representation of the hazard h(t) • cf. Density <-> Distribution 18 6 0.5 1.0 1.5 haz exg(mu=0, sigma=1, nu=1) haz exg(mu=0, sigma=0.5, nu=1) cum haz exg(mu=0, sigma=1, nu=1) cum haz exg(mu=0, sigma=0.5, nu=1) 0.0 h1 2.0 2.5 3.0 Hazard and cumulative Hazard for Ex-Gauss -10 -5 0 5 10 15 19 0.2 0.4 y1 exg(mu=0, sigma=1, nu=1) exg(mu=0, sigma=0.5, nu=1) exg(mu=0, sigma=1, nu=1) exg(mu=0, sigma=0.5, nu=1) 0.0 Literature 0.6 0.8 1.0 Comparing Ex-Gauss CDF and hazard function -2 0 2 4 xx • Ashby, Tein & Balakrishnan, 1993 • Maddox, Ashby & Gottlob, 1998 • Bloxom, 1984 • Thomas, 1971 • Colonius, 1988 • Burbeck & Luce, 1982 • Luce, 1986 20 6 III ESTIMATION THEORY 21 Next steps • Theoretical analysis of distributions and their discrimination is important but in research practice another aspect also paramount • „good“ estimation of densities, distribution and hazard functions are the first step to analyse RT data 22 AND NOW TO 23