1.2.3-SNAPSHOT Arrow_down_16x16

bland-altman-plot

incanter.charts

  • (bland-altman-plot x1 x2 & options)


Examples:

(use '(incanter core datasets charts))
(def flow-meter (to-matrix (get-dataset :flow-meter)))
(def x1 (sel flow-meter :cols 1))
(def x2 (sel flow-meter :cols 3))
(view (bland-altman-plot x1 x2))

(with-data (get-dataset :flow-meter)
(view (bland-altman-plot "Wright 1st PEFR" "Mini Wright 1st PEFR")))



References:
http://en.wikipedia.org/wiki/Bland-Altman_plot
http://www-users.york.ac.uk/~mb55/meas/ba.htm

0 Examples top

Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source incanter/charts.clj:2671 top

(defn bland-altman-plot
"

  Examples:

    (use '(incanter core datasets charts))
    (def flow-meter (to-matrix (get-dataset :flow-meter)))
    (def x1 (sel flow-meter :cols 1))
    (def x2 (sel flow-meter :cols 3))
    (view (bland-altman-plot x1 x2))

    (with-data (get-dataset :flow-meter)
      (view (bland-altman-plot \"Wright 1st PEFR\" \"Mini Wright 1st PEFR\")))



  References:
    http://en.wikipedia.org/wiki/Bland-Altman_plot
    http://www-users.york.ac.uk/~mb55/meas/ba.htm

"
  ([x1 x2 & options]
      (let [opts (when options (apply assoc {} options))
	    data (:data opts)
	    _x1 (if (coll? x1) (to-list x1) ($ x1 data))
	    _x2 (if (coll? x2) (to-list x2) ($ x2 data))
	    plot (scatter-plot (div (plus _x1 _x2) 2) (minus _x1 _x2)
                               :title "Bland Altman Plot"
                               :legend false)
            x-axis (div (plus _x1 _x2) 2)
            y-axis (minus _x1 _x2)
            min-x (reduce min x-axis)
            max-x (reduce max x-axis)
            _x (range min-x max-x (/ (- max-x min-x) 100))
            y-sd (* (sd y-axis) 2)
	    theme (or (:theme opts) :default)]
        (do
          (add-lines plot _x (repeat (count _x) 0) :series-label "mean")
          (add-lines plot _x (repeat (count _x) y-sd) :series-label "mean + sd")
          (add-lines plot _x (repeat (count _x) (- 0 y-sd)) :series-label "mean - sd")
	  (set-theme plot theme)
          plot))))
Vars in incanter.charts/bland-altman-plot: - count defn let repeat
Used in 0 other vars

Comments top

No comments for bland-altman-plot. Log in to add a comment.