Created
April 21, 2009 13:56
-
-
Save liebke/99153 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
(use '(incanter core stats charts)) | |
;; generate a sample from a bi-variate normal distribution | |
(def mvn-samp (sample-mvn 1000 :mean [7 5] :sigma (matrix [[2 1.5] [1.5 3]]))) | |
(def x (sel mvn-samp :cols 0)) | |
(def y (sel mvn-samp :cols 1)) | |
;; add regression line to scatter plot | |
(def lm (linear-model y x)) | |
;; plot scatter-plot of points | |
(doto (scatter-plot x y) | |
view | |
(add-lines x (:fitted lm))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
One small change needed to run this on current Incanter: Replace sample-multivariate-normal with sample-mvn