• incanter

# pdf-f

## incanter.stats

• (pdf-f x & options)
Returns the F pdf of the given value, x. It will return a sequence
of values, if x is a sequence. This is equivalent to R's df function.

Options:
:df1 (default 1)
:df2 (default 1)

cdf-f and quantile-f

References:
http://en.wikipedia.org/wiki/F_distribution
http://mathworld.wolfram.com/F-Distribution.html
http://en.wikipedia.org/wiki/Probability_density_function

Example:
(pdf-f 1.0 :df1 5 :df2 2)

### Source incanter/stats.clj:81 top

```(defn pdf-f
" Returns the F pdf of the given value, x. It will return a sequence
of values, if x is a sequence. This is equivalent to R's df function.

Options:
:df1 (default 1)
:df2 (default 1)

cdf-f and quantile-f

References:
http://en.wikipedia.org/wiki/F_distribution
http://mathworld.wolfram.com/F-Distribution.html
http://en.wikipedia.org/wiki/Probability_density_function

Example:
(pdf-f 1.0 :df1 5 :df2 2)
"
([x & options]
(let [opts (when options (apply assoc {} options))
df1 (or (:df1 opts) 1)
df2 (or (:df2 opts) 1)
pdf-fx (fn [x]
(* (/ (gamma (/ (+ df1 df2) 2))
(* (gamma (/ df1 2)) (gamma (/ df2 2))))
(pow (/ df1 df2) (/ df1 2))
(pow x (- (/ df1 2) 1))
(pow (+ 1 (* (/ df1 df2) x))
(- 0 (/ (+ df1 df2) 2)))))
]
(if (coll? x)
(map pdf-fx x)
(pdf-fx x)))))```
Vars in incanter.stats/pdf-f: coll? defn let map
Used in 0 other vars