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
Introduction to probability theory
• Phenomenon and conception of randomness
II
Random variables and their characterization
• Probability space (Ω, A, P)
• Random Variables and their calculus
• Continuous and discrete distributions
III
Estimation
Theory
• Characterization
of RVs by...
• Law of large numbers + Central limit theorem
• Moments (mean, variance, ...)
IV
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

x  
exp
2
2
2
2
fexp ( x)   expx
6
0.5
II
0.0
0.1
0.2
f(X)
0.3
0.4
Normal Density
Exponential Density
-2
0
2
X
4
6
7
Other functional forms of X
II
• 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 inferenceII
Shift family
of N(μ, σ2)
Likelihood ratio
Density function
Hazard function
Density Crosses
Distribution fct.
RV compensation
Means
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:
x
F(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) limt->0 F(t) = 0
iii) limt->∞ 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:
number of elements  t 1
ˆ
Fn (t ) 
  1xi  t
n
n
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