Presentation is loading. Please wait.

Presentation is loading. Please wait.

Analysis of RT distributions with R Emil Ratko-Dehnert WS 2010/ 2011 Session 04 – 30.11.2010.

Similar presentations


Presentation on theme: "Analysis of RT distributions with R Emil Ratko-Dehnert WS 2010/ 2011 Session 04 – 30.11.2010."— Presentation transcript:

1 Analysis of RT distributions with R Emil Ratko-Dehnert WS 2010/ 2011 Session 04 – 30.11.2010

2 Last time... Random variables (RVs) – Definition and examples (-> mapping from Ω to R) – Calculus and distributions (-> additivity, multiplicity,...) Characterization of RVs – By moments and descriptives (-> Mean, Var, Mode,Median) 2

3 RANDOM VARIABLES & THEIR CHARACTERIZATION 3 II

4 Recap: E(X), Var(X) „What is the expected (long term) outcome of X?“ „How much do the values of a RV X vary around its mean value X ?“ 4 II

5 Calculus for E(X) E( X + c ) = E( X ) +c (scalar additivity) E( X + Y ) = E( X ) + E( Y ) (linearity) E( a*X ) = a*E( X ) (scalar multipl.)  However(!): E( X * Y ) ≠ E( X ) * E( Y ) (non-multiplicity) II 5

6 Calculus for Var(X) Var( X ) = E( X 2 ) – ( E( X ) 2 ) (alternative formula) Var( a * X + b ) = a 2 * Var( X ) (scalar „additivity“) Var( X + Y ) = Var( X ) + Var( Y ) + 2 * Cov( X,Y ) Var( Σ X i ) = Σ Var( X i ), X i uncorr.(Bienaymé) II 6

7 Further properties of RVs Covariance Cov(X, Y) Correlation Corr(X, Y) Independance of RV‘s Identically distributedness of RV‘s II 7 IID

8 Covariance Cov(X, Y) „The Covariance of RV‘s X and Y is a measure of how much they change together“ The standardized covariance is the Correlation Corr(X,Y) 8 II

9 Correlation Corr(X, Y) One way of standardizing leads to the Pearson‘s correlation coefficient  Don‘t confuse this with causality!  Neither confuse it with linearity! 9 II

10 Example: Correlations (1) 10 II

11 Example: Correlations (2) 11 II Corr(X,Y) = 0.816 for all

12 Independance of RV‘s Two RV‘s X and Y are said to be independant, if their expectations factorize: Then: 12 II

13 Independance and Covariance If X, Y are independant, their covariance is zero Warning! The converse is generally not true: i.e. X, Y can have Cov(X,Y) = 0 and not be independant. 13 II

14 Identical distribution Two RV‘s X and Y are said to be identically distributed, if they share the same distribution: E.g.: X ~ N(0,1) and Y ~ N(0,1) are identically distributed Ergo: each observation can be treated like it was taken from the exact same distribution as the other 14 II

15 Examples: IID RVs a sequence of outcomes of spins of a roulette wheel is IID a sequence of dice rolls is IID a sequence of coin flips is IID RTs are often treated as IID events, though this is rarely checked and frequently violated 15 II

16 Significance of IID IID assumption important for many reasons In our case most importantly – identical conditions across trials should have the same effect (no intertrial or position effects!) – Required for law of large numbers and central limit theorem – Required for many statistical tests (e.g. z-test) 16 II

17 AND NOW TO 17

18 Creating own functions new.fun <- function(arg1, arg2, arg3){ x <- exp(arg1) y <- sin(arg2) z <- mean(arg2, arg3) result <- x + y + z result } A <- new.fun(12, 0.4, -4) 18 „inputs“ „output“ Algorithm of function Usage of new.fun

19 Using Loops in R result <- matrix(NA, nrow = 20, ncol = 10) for(i in 1:10){ xx <- rnorm(n = 10, mean = i, sd = 4) result [c(1:20), i] <- xx } result 19 Create empty frame for loop Fill columns of exp with xx Running index of loop


Download ppt "Analysis of RT distributions with R Emil Ratko-Dehnert WS 2010/ 2011 Session 04 – 30.11.2010."

Similar presentations


Ads by Google