Analysis of RT distributions with R - uni

Download Report

Transcript Analysis of RT distributions with R - uni

Analysis of RT distributions with R

Emil Ratko-Dehnert WS 2010/ 2011 Session 08 – 11.01.2011

Last year ...

• Excursion on ANOVA theory – Main idea, designs – mathematcial model – One-way test – Power analysis, Effect size – A priori/ Post hoc tests, Follow-up tests 2

Where are we?

I II III IV

Introduction to probability theory • Phenomenon and conception of randomness • Random variables and their characterization Probability space (Ω, A, P) • • • • Random Variables and their calculus Continuous and discrete distributions Estimation Theory Law of large numbers + Central limit theorem • Moments (mean, variance, ...) Model testing • Descriptive statistics (mode, median, quantiles)  Distributional parameters 3

II

FUNCTIONAL FORMS OF RANDOM VARIABLES

4

RVs characterized by paramters

II

• Once the distribution family of a random variable X is known (or set), one can uniquely characterize (or fit) the distribution by parameters • Examples

X ~ N(μ, σ 2 )

(normal distrib.)

X ~ Exp(λ)

(exponential distrib.) 5

II

Density functions

• The density itself is a functional form of the RV X:

X ~ N(μ, σ 2 ) X ~ Exp(λ)

f norm

(

x

)  1 2  2 exp 

x

2    2  2

f

exp (

x

)   exp   

x

6

Normal Density Exponential Density

II

-2 0 X 2 4 6 7

II

Other functional forms of X

Cumulative distribution function or CDF (F(X))Hazard function (H(X)) and Survivor function (S(X))

! Note !

RVs are (stochastically) uniquely defined by their probability density function. All other functional forms are equivalent to it.

8

What is the „best“ characterization?

II

„It makes sense [...] to examine changes in RT not just at the level of the means, but at the strongest level of Townsends hierarchy, because all other weaker properties are then implied.“

(Van Zandt, 2000) 9

Townsend‘s system of hierarchical inference

II

Shift family of N(μ, σ2) Likelihood ratio Density function Density Crosses Hazard function Distribution fct.

Means RV compensation Medians Proportions 10

(CUMULATIVE) DISTRIBUTION FUNCTION

11

The cumulative distribution function F(X) adds up the probabilities of P(X) Discrete case:

F

(

X

) 

P

(

X

x

) Continuous case:

F

(

X

) 

x

  

f

(

t

)

dt

12

Cumulative distribution Function

Any function F(t) that satisfies i) – iii) is a CDF i) F(t) is positive and non-decreasing ii) lim

t->0 F(t) = 0

iii) lim

t->∞ F(t) = 1

13

Quantiles

• Divide data into q equal-sized data subsets. Quantiles are data values dividing consecutive subsets • Prominent quantiles – 2-quanile = median – 4- quantiles = quartiles – 10-quantiles = deciles – 100-quantiles = percentiles 14

Pro CDF

„The CDF is the easiest of the functional forms

to estimate [...]“ (Van Zandt, 2000) • Empirical Cumulative Distribution Function:

F

ˆ

n

(

t

)  number of elements

n

t

 1

n

1

x i

t

 15

16

Contra CDF

• May be inappropriate to distinguish between different distributions RTs in ms 17

Tests for CDFs

Kolmogorov-Smirnof Test:

– Non-parametric. Compares sample distribution to reference distribution or two distributions to each other •

Kuiper‘s Test

– Similar to KS, but more sensitive for testing cyclic variations by time 18

CDFS WITH R

19

Built-in functions

• For built-in distributions – dexp, dnorm, dunif, dpois, dbeta ...

just use the call – pexp, pnorm, punif, ppois, pbeta ...

to aquire the cumulative distribution function and plot it or analyse it 20

ecdf(x)

• The ecdf(x) command generates a stepfunction – the empirical cumulative distribution function • One can plot the result by plot.ecdf(x) or plot(ecdf(x)) • One can access the data via knots(ecdf(x)) or summary(ecdf(x)) 21

ks-.test()

• The one-sample Kolmogorov-Smirnof Test can be performed by the command ks.test(x, „pnorm“, 0, 1) • In order to be able to compare x to the standard normal distribution, R automatically standardizes the data before performing the test.

• The two-sample version is ks.test(x, y, alternative = „greater“) • If the result is significant, then the null hypthesis („x and y are drawn from the same distribution“) must be rejected.

22

AND NOW TO

23