Guest User

Untitled

a guest
Feb 7th, 2022
11
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. my_sample <- c(80, 90, 100, 80, 130)
  2. mu0 <- 125
  3. mean(my_sample)
  4. t.test(my_sample, mu = mu0, alternative = 'greater')
  5. # mu > mu0
  6. curve(dt(x, df=4), from = -5, to=5)
  7. # exercise
  8. # Find p-value for alternative = 'less'
  9. # We can do it without R
  10. 1 - 0.9824
  11. t.test(my_sample, mu = mu0, alternative = 'less')
  12. # Find p-value for alternative = 'two.sided'
  13. # H1: mu != mu0
  14. # We do it without R
  15. t.test(my_sample, mu = mu0, alternative = 'two.sided')
  16. 0.01764 * 2
  17. x <- c(3, 2, 5, 1, 7) # treatment group
  18. y <- c(4, 5, 3, 5, 7, 8) # control group
  19. t.test(x, y, alternative = 'less')
  20. t.test(x, y, alternative = 'two.sided')
  21. t.test(rep(x, 3), rep(y, 3), alternative = 'less')
  22. dat <- read.csv("https://bit.ly/39Fr0gD")
  23. # Is it true that time for round sounds is
  24. # greater or less than time for unrounded sounds?
  25. round_times <- dat[dat$roundness == "round", "time"]
  26. # get values of time variable
  27. # where roundness == "round"
  28. dat[dat$roundness == "round", "time"]
  29.  
  30. unrounded_times <- dat[dat$roundness == "unrounded", "time"]
  31. round_times
  32. mean(round_times)
  33. sd(round_times)
  34. length(round_times)
  35.  
  36. mean(unrounded_times)
  37. sd(unrounded_times)
  38. length(unrounded_times)
  39.  
  40. # Exercise:
  41. # use t.test to test a hypothesis
  42. # and answer: can we say that
  43. # there is a statistically significant
  44. # difference between round and unrounded times?
  45.  
  46. t.test(round_times, unrounded_times)
  47. # p-value = 0.33 > 0.05 => do not reject H0
  48.  
  49. t.test(time ~ roundness, data=dat)
  50. unique(dat$roundness)
  51.  
  52. t.test(vowel.dur ~ roundness, data=dat)
  53.  
Add Comment
Please, Sign In to add comment