# -----------------------------------------------------
# Multinomial Distribution Example
# -----------------------------------------------------
# Create the distribution
N <- 10 ; p <- c(0.1, 0.2, 0.7)
D <- Multinom(N, p)
# ------------------
# dpqr Functions
# ------------------
d(D, c(2, 3, 5)) # density function
# alternative way to use the function
df <- d(D) ; df(c(2, 3, 5)) # df is a function itself
x <- r(D, 100) # random generator function
# ------------------
# Moments
# ------------------
mean(D) # Expectation
mode(D) # Mode
var(D) # Variance
entro(D) # Entropy
finf(D) # Fisher Information Matrix
# List of all available moments
mom <- moments(D)
mom$mean # expectation
# ------------------
# Point Estimation
# ------------------
ll(D, x)
llmultinom(x, N, p)
emultinom(x, type = "mle")
emultinom(x, type = "me")
mle(D, x)
me(D, x)
e(D, x, type = "mle")
mle("multinom", x) # the distr argument can be a character
# ------------------
# Estimator Variance
# ------------------
vmultinom(N, p, type = "mle")
vmultinom(N, p, type = "me")
avar_mle(D)
avar_me(D)
v(D, type = "mle")
Run the code above in your browser using DataLab