1.2.3-SNAPSHOT Arrow_down_16x16

cumulative-mean

incanter.stats

  • (cumulative-mean coll)
Returns a sequence of cumulative means for the given collection. For instance
The first value equals the first value of the argument, the second value is
the mean of the first two arguments, the third is the mean of the first three
arguments, etc.

Examples:
(cumulative-mean (sample-normal 100))

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/stats.clj:1831 top

(defn cumulative-mean
  " Returns a sequence of cumulative means for the given collection. For instance
    The first value equals the first value of the argument, the second value is
    the mean of the first two arguments, the third is the mean of the first three
    arguments, etc.

    Examples:
      (cumulative-mean (sample-normal 100))
  "
  ([coll] (map / (cumulative-sum coll) (range 1 (inc (count coll))))))
Vars in incanter.stats/cumulative-mean: / count defn inc map range
Used in 0 other vars

Comments top

No comments for cumulative-mean. Log in to add a comment.