Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. library(tidyverse)
  2. ## two samples t-test
  3. df1 <- ... # independent variables
  4. df2 <- ... # dependent paired variables (time course or different measures on the same person)
  5. t.test(df1$LI~df2$HQ) # for long format datasets, group variable after the ~
  6.  
  7. df1[df1$HQ == 'RH', 1] # dataset of one variable
  8. rh <- df1$LI[df1$HQ == 'RH'] # vector
  9. lh <- df1$LI[df1$HQ == 'LH']
  10. shapiro.test(lh) # are these distributions normal?
  11. shapiro.test(rh)
  12. t.test(lh, rh) # for normal distributions
  13. wilcox.test(lh, rh) # forn not normal distributions
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement