Created
June 3, 2009 01:12
-
-
Save liebke/122720 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; compare the means of different treatments in the plant-growth data set | |
(use '(incanter core stats charts datasets)) | |
;; load the plant-growth data | |
(def plant-growth (to-matrix (get-dataset :plant-growth))) | |
;; create box-plots of the three treatment groups | |
(view (box-plot (sel plant-growth :cols 0) | |
:group-by (sel plant-growth :cols 1))) | |
(def groups (group-by plant-growth 1 :cols 0)) | |
(map mean groups) ;; returns (5.032 4.661 5.526) | |
;; run three different t-tests comparing the treatments | |
(def t-tests [(t-test (second groups) :y (first groups)) | |
(t-test (last groups) :y (first groups)) | |
(t-test (second groups) :y (last groups))]) | |
;; view the p-values of the three-tests | |
(map :p-value t-tests) ;; returns (0.250 0.048 0.009) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment