Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. bodymass pregnant
  2. 28.5 yes
  3. 33.3 no
  4. 23.4 yes
  5. 26.6 no
  6. 34.1 no
  7. 26.4 yes
  8. 45.6 no
  9. 25.3 yes
  10. 25.5 no
  11. 24 yes
  12.  
  13. dfd<- data.frame(matrix(nrow = 10, ncol = 2))
  14. dfd[,1]<- mother$bodymass
  15. dfd[,2]<- mother$pregnant
  16. header<- c('bodymass', 'pregnant')
  17. colnames(dfd)<- header
  18. dfd
  19. chisq.test(dfd)
  20.  
  21. df <- read.table(text = "
  22. bodymass pregnant
  23. 28.5 yes
  24. 33.3 no
  25. 23.4 yes
  26. 26.6 no
  27. 34.1 no
  28. 26.4 yes
  29. 45.6 no
  30. 25.3 yes
  31. 25.5 no
  32. 24 yes", header = T, stringsAsFactors = F)
  33.  
  34. wilcox.test(bodymass ~ pregnant, data = df, alternative = "two.sided", paired = FALSE)
  35.  
  36. Wilcoxon rank sum test
  37.  
  38. data: bodymass by pregnant
  39. W = 22, p-value = 0.05556
  40. alternative hypothesis: true location shift is not equal to 0
  41.  
  42. library(ggbeeswarm)
  43. ggplot(df, aes(pregnant, bodymass, color = pregnant)) + geom_boxplot() + geom_beeswarm()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement