Skip to content

Instantly share code, notes, and snippets.

@liebke
Created April 20, 2009 19:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save liebke/98686 to your computer and use it in GitHub Desktop.
Save liebke/98686 to your computer and use it in GitHub Desktop.
;; Examples of plots from the Gamma Distribution page at
;; Wikipedia (http://en.wikipedia.org/wiki/Gamma_distribution)
(use '(incanter stats charts io))
(def x (range 0 20 0.1))
(def gamma-plot (xy-plot x (pdf-gamma x :shape 1 :rate 2)
:legend true
:title "Gamma PDF"
:y-label "Density"))
(view gamma-plot)
(add-lines gamma-plot x (pdf-gamma x :shape 2 :rate 2))
(add-lines gamma-plot x (pdf-gamma x :shape 3 :rate 2))
(add-lines gamma-plot x (pdf-gamma x :shape 5 :rate 1))
(add-lines gamma-plot x (pdf-gamma x :shape 9 :rate 0.5))
(clear-background gamma-plot)
(save gamma-plot "/tmp/gamma_pdf.png")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment