Skip to contents

Var(X) = E[(X - mu)^2] (eq 3.19), cross-checked against the computational form E(X^2) - mu^2 (eq 3.34); their agreement is eq (3.35) and the square root is eq (3.40).

Usage

PmfVar(values, probs)

Arguments

values, probs

the pmf; probs must be >= 0 and sum to 1.

Value

list(variance, mean, e_x2, sd, forms_agree).

References

Morin, D. J. (2016). Probability: For the Enthusiastic Beginner. Createspace. Eqs (3.19), (3.34)-(3.35), (3.40), (3.59).

Examples

PmfVar(1:6, rep(1 / 6, 6))$variance
#> [1] 2.916667