Description Usage Arguments Value Examples
Expected Values of Discrete Random Variables
1 2 |
xv |
Vector of random variable values |
fx |
List of probability distributions (2~9) |
fx2 |
Second list of probability distributions (same number of fx) |
fx3 |
Third list of probability distributions (same number of fx) |
mt |
Vector of plot titles |
dig |
Number of digits below decimal point, Default: 3 |
del |
Distance between the probability distribution plots, Default: 0.2 |
prt |
Print the expected values and variances? Default: TRUE |
plot |
Plot the probability distributions? Default: TRUE |
list(Ex, Vx, Dx)
1 2 3 4 5 6 7 8 9 10 11 | # Binomial distributions
n = 10; p=c(0.2, 0.5, 0.8); x = 0:n
fx1 = fx2 = list()
for (i in 1:3) fx1[[i]] = dbinom(x, n, p[i])
mt1 = paste0("B(10,", p, ")")
disc.mexp(x, fx1, mt=mt1)
# Binomial vs. Hypergeometric
N = 50; S =c(10, 25, 40); n = 10; x = 0:n
for (i in 1:3) fx2[[i]] = dhyper(x, S[i], N-S[i], n)
mt12 = paste0("HG(10,50,", S,"):B(10,", p,")")
disc.mexp(x, fx2, fx1, mt=mt12)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.