analysis of rt distributions with r

27
Analysis of RT distributions with R Emil Ratko-Dehnert WS 2010/ 2011 Session 07 – 21.12.2010

Upload: forrest-herrera

Post on 31-Dec-2015

54 views

Category:

Documents


1 download

DESCRIPTION

Analysis of RT distributions with R. Emil Ratko-Dehnert WS 2010/ 2011 Session 07 – 21.12.2010. Last time. Introduced significance tests (most notably the t -test) Test statistic and p-value Confusion matrix Prerequisites and necessary steps Students t -test Implementation in R. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Analysis of RT distributions with R

Analysis of RT distributionswith R

Emil Ratko-DehnertWS 2010/ 2011

Session 07 – 21.12.2010

Page 2: Analysis of RT distributions with R

Last time ...• Introduced significance tests (most notably

the t-test)

– Test statistic and p-value

– Confusion matrix

– Prerequisites and necessary steps

– Students t-test

– Implementation in R2

Page 3: Analysis of RT distributions with R

ANALYSIS OF VARIANCES

3

Page 4: Analysis of RT distributions with R

ANOVA

• The Analysis of Variance is a collection of statis-

tical test

• Their aim is to explain the variance of a DV

(metric) by one or more (categorial) factors/ IVs

• Each factor has different factor levels

4

Page 5: Analysis of RT distributions with R

Main idea• Are the means of different groups (by factors)

different from each other?

• Is the variance of a group bigger than of the

whole data?5

ji

n

jiH

H

:,:

:

1

210

Page 6: Analysis of RT distributions with R

ANOVA designs

• One-way ANOVA is used to test for differences

among two or more independent groups.

• Typically, however, the one-way ANOVA is used to

test for differences among at least three groups,

since the two-group case can be done by a t-test

6

Page 7: Analysis of RT distributions with R

ANOVA designs (cont.)

• Factorial ANOVA is used when the experimenter

wants to study the interaction effects among

the treatments.

• Repeated measures ANOVA is used when the

same subjects are used for each treatment (e.g.,

in a longitudinal study).7

Page 8: Analysis of RT distributions with R

ONE-WAY ANOVA

8

Page 9: Analysis of RT distributions with R

One-way ANOVA

• A one-way ANOVA is a generalization of the t-test

for more than two independent samples

• Suppose we have k populations of interest

• From each we take a random sample, for the ith

sample, let Xi1, Xi2, ..., Xini designate the sample

values9

Page 10: Analysis of RT distributions with R

Prerequisites

The data should ...

1) be independent

2) be normally distributed

3) have equal Variances

(homoscedasticity)

10

Page 11: Analysis of RT distributions with R

Mathematical model

11

• Xij = dependant variable

• i = group (i in 1, ..., k)

• j = elements of group i (j in 1, ..., ni)

• ni = sample size of group i

• εij = error term; ε ~ N(0, σ)

ijiijX

Page 12: Analysis of RT distributions with R

Hypotheses

• Suppose we have k independent, iid samples

from populations with N(μi, σ) distributions,

i = 1, ... k. A significance test of

• Under H0, F has the F-distribution with k-1 and

n-k degrees-of-freedom. 12

ji

k

jiH

H

:,:

:

1

210

Page 13: Analysis of RT distributions with R

Fk-1, n-k with

k = amount of

factors and

n = sample size

13

Page 14: Analysis of RT distributions with R

Example

• Two groups of animals receive different diets

• The weights of animals after the diet are:

Group 1: 45, 23, 55, 32, 51, 91, 74, 53, 70, 84 (n1 = 10)

Group 2: 64, 75, 95, 56, 44, 130, 106, 80, 87, 115 (n2 =

10) 14

Page 15: Analysis of RT distributions with R

Example (cont.)

• Do the different diets have an effect on the weight?

• Means differ, but this might be due to natural variance

15

8.571x

2.852 x

1

1

211

11 7.479)(

1

1var

n

i xxn

2

1

222

22 6.728)(

1

1var

n

i xxn

Page 16: Analysis of RT distributions with R

Example (cont.)

• Global variance

• Test statistic

16

21

2211 varvarvar

nn

nng

21.6var)(

)(

21

22121

gnn

xxnnF

Page 17: Analysis of RT distributions with R

Example (cont.)

• To assess difference of means, we need to compare

this F-value with the one we would get for the

for alpha = 0.05

F = 4.41

6.21 > 4.41

H0 can be rejected17

Page 18: Analysis of RT distributions with R

ANOVA (CONT.)

18

Page 19: Analysis of RT distributions with R

Effect size η2

• The effect size describes the ratio of variance

explained in the dependant variable by a

predictor while controlling for other

predictors

19

total

treatment

s

s2

Page 20: Analysis of RT distributions with R

Power Analysis

• is often applied in order to assess the probability

of successfully rejecting H0 for specific designs,

effect sizes, sample size and α-level.

• can assist in study design by determining what

sample size would be required in order to have a

reasonable chance of rejecting the H0 when H1 is

true. 20

Page 21: Analysis of RT distributions with R

A priori vs. post hoc analysis

• A priori analysis (before data collection) is used to

determine the appropriate sample size to achieve

adequate power

• Post hoc analysis (after data collection) uses

obtained sample size and effect size to determine

power of the study21

Page 22: Analysis of RT distributions with R

Follow-up tests

• ANOVA only decides whether (at least) one pair of

means is different, one commonly conducts

follow-up tests to assess which groups are

different:

Bonferroni-Test

Scheffé-Test

Tuckey‘s Range Test22

Page 23: Analysis of RT distributions with R

Visualisation of ANOVAs

http://www.psych.utah.edu/stat/introstats/anovaflash.html

23

Page 24: Analysis of RT distributions with R

ANOVAS WITH R

24

Page 25: Analysis of RT distributions with R

oneway.test()

• The R function oneway.test() will perform the

one-way ANOVA

• One can use the model notation

oneway.test(values ~ ind, data = data)

to assign values to groups

25

Page 26: Analysis of RT distributions with R

aov()

• Alternatively one can use the more general

aov() command for the one-way ANOVA

fit <- aov(y ~ A, data = mydataframe)

plot(fit) # diagnostic plots

summary(fit) # display ANOVA table

26

Page 27: Analysis of RT distributions with R

AND NOW TO

27