1 / 19

Analysis of RT distributions with R

Analysis of RT distributions with R. Emil Ratko-Dehnert WS 2010/ 2011 Session 04 – 30.11.2010. Last time. Random variables (RVs) Definition and examples (-> mapping from Ω to R) Calculus and distributions (-> additivity, multiplicity, ...) Characterization of RVs

Download Presentation

Analysis of RT distributions with R

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Analysis of RT distributionswith 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)

  3. II Random Variables &their characterization

  4. II 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 ?“

  5. II 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)

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

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

  8. II 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)

  9. II 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!

  10. II Example: Correlations (1)

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

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

  13. II 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.

  14. II 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

  15. II 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

  16. II 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)

  17. And now to

  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) „inputs“ Algorithm of function „output“ Usage of new.fun

  19. Using Loops in R Create empty frame for loop 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 Running index of loop Fill columns of exp with xx

More Related