inst/snippet/discDists-mean-coins01.R

vals <- 0:4
probs <- c(1,4,6,4,1) / 16      # providing probabilities directly
sum(vals * probs)
sum(0:4 * dbinom(0:4,4,0.5))     # using the fact that X is binomial

Try the fastR package in your browser

Any scripts or data that you put into this service are public.

fastR documentation built on May 1, 2019, 11:18 p.m.