# -----------------------------------------------------
# Dir Distribution Example
# -----------------------------------------------------
# Create the distribution
a <- c(0.5, 2, 5)
D <- Dir(a)
# ------------------
# dpqr Functions
# ------------------
d(D, c(0.3, 0.2, 0.5)) # density function
x <- r(D, 100) # random generator function
# alternative way to use the function
df <- d(D) ; df(x) # df is a function itself
# ------------------
# 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)
lldir(x, a)
edir(x, type = "mle")
edir(x, type = "me")
mle(D, x)
me(D, x)
e(D, x, type = "mle")
mle("dir", x) # the distr argument can be a character
# ------------------
# Estimator Variance
# ------------------
vdir(a, type = "mle")
vdir(a, type = "me")
avar_mle(D)
avar_me(D)
v(D, type = "mle")
Run the code above in your browser using DataLab