Advertisement
Guest User

Untitled

a guest
Aug 18th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. table(a); table(b)
  2. a
  3. 1 2 3 4 5
  4. 12 38 46 73 81
  5. b
  6. 1 2 3 4 5
  7. 20 37 68 73 52
  8.  
  9. summary(a); summary(b)
  10. a: Min. 1st Qu. Median Mean 3rd Qu. Max.
  11. 1.000 3.000 4.000 3.692 5.000 5.000
  12. b: Min. 1st Qu. Median Mean 3rd Qu. Max.
  13. 1.0 3.0 3.5 3.4 4.0 5.0
  14.  
  15. t.test(a,b)
  16.  
  17. Welch Two Sample t-test
  18.  
  19. data: a and b
  20. t = 2.7127, df = 497.97, p-value = 0.006905
  21. alternative hypothesis: true difference in means
  22. is not equal to 0
  23. 95 percent confidence interval:
  24. 0.0805107 0.5034893
  25. sample estimates:
  26. mean of x mean of y
  27. 3.692 3.400
  28.  
  29. wilcox.test(a,b)$p.val
  30. [1] 0.004490969
  31.  
  32. DTA = rbind(tabulate(a), tabulate(b))
  33. ab.out = chisq.test(DTA); ab.out
  34.  
  35. Pearson's Chi-squared test
  36.  
  37. data: DTA
  38. X-squared = 12.582, df = 4, p-value = 0.01351
  39.  
  40. ab.out$obs
  41. [,1] [,2] [,3] [,4] [,5]
  42. [1,] 12 38 46 73 81
  43. [2,] 20 37 68 73 52
  44. ab.out$exp
  45. [,1] [,2] [,3] [,4] [,5]
  46. [1,] 16 37.5 57 73 66.5
  47. [2,] 16 37.5 57 73 66.5
  48. ab.out$resi
  49. [,1] [,2] [,3] [,4] [,5]
  50. [1,] -1 0.08164966 -1.456986 0 1.778104
  51. [2,] 1 -0.08164966 1.456986 0 -1.778104
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement