Computes the exact expected total run count for mutually independent Bernoulli trials whose success probabilities may vary by position.
Details
The expectation is one plus the sum of the probabilities that successive observations differ. It is conditional on the supplied probabilities and the mutual-independence assumption.
Examples
runs_mean(c(0.15, 0.40, 0.75, 0.60))