xeris-s_lair

ch 9 prob 9 & 10

Oct 27th, 2025 (edited)
18
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
R 2.34 KB | Source Code | 0 0
  1. ##ch 9 prob 9
  2. ch9_prob3_data <- read.csv("C:/Users/benny/Downloads/ch9_prob3_data.csv")
  3. data=ch9_prob3_data
  4.  
  5. install.packages("BSDA") #this took obscenely long to install and i think it's bc i didnt put BDSA in quotations
  6. library(BSDA)
  7. SIGN.test(data$post,data$pre,alternative="greater")
  8. ## OUTPUT:
  9. # Dependent-samples Sign-Test
  10. # data:  data$post and data$pre
  11. # S = 20, p-value = 0.002039
  12. # alternative hypothesis: true median difference is greater than 0
  13. # 95 percent confidence interval:
  14. #   2 Inf
  15. # sample estimates:
  16. # median of x-y
  17. #           3
  18. #Achieved and Interpolated Confidence Intervals:
  19. #                 Conf.Level L.E.pt U.E.pt
  20. # Lower Achieved CI     0.8998      2    Inf
  21. # Interpolated CI       0.9500      2    Inf
  22. # Upper Achieved CI     0.9506      2    Inf
  23. #####  questions ####
  24. # a. the paired t-test alt hypo focuses on the true mean and it be not equal to 0, while the sign test's A.H. is the true median #difference being greater than 0
  25. # b. the probability (p=0.002039) of the difference of the mean being greater than 0
  26. # c. the data suggest that it is likely that the ginkgo supplement improved memory
  27. # d. determining which test to use depends on what assumptions are true for the data, which would make a certain test stronger
  28. # e. the non-parametric sign test is weaker than the parametric paired t-test because the Normality assumption has been violated
  29.  
  30. ### problem 10 ###
  31. ch9_prob5_data <- read.csv("C:/Users/benny/Downloads/ch9_prob5_data.csv")
  32. data5=ch9_prob5_data
  33. wilcox.test(data5$treatment,data$pre,conf.int = TRUE,exact = FALSE)
  34. ## OUTPUT ##
  35. #  Wilcoxon rank sum test with continuity correction
  36. # data:  data5$treatment and data$pre
  37. # W = 531.5, p-value = 0.2305
  38. # alternative hypothesis: true location shift is not equal to 0
  39. # 95 percent confidence interval:
  40. # -1.999932  8.000014
  41. # sample estimates:
  42. # difference in location
  43. #           3.000008
  44. ### questions ###
  45. # a. the p-value (0.2305) lands in the grey zone of p-val. significance, so it suggests that the ginkgo supplements may somewhat #improve memory test scores
  46. # b. 8.000014 - 3.000008 = 5.000006(+-)3
  47. # c. the data suggest that ginkgo supplements may improve memory test scores by 5(+-)3 points, but more research is needed
  48. # d. the M-W U-test functions off the Normality assumption being violated, while the 2-sample test assumes Normality
Advertisement
Add Comment
Please, Sign In to add comment