# -----------------------------------------------------
# Binomial Distribution Example
# -----------------------------------------------------
# Create the distribution
N <- 10 ; p <- 0.7
D <- Binom(N, p)
# ------------------
# dpqr Functions
# ------------------
d(D, 0:N) # density function
p(D, 0:N) # distribution function
qn(D, c(0.4, 0.8)) # inverse distribution 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
var(D) # Variance
sd(D) # Standard Deviation
skew(D) # Skewness
kurt(D) # Excess Kurtosis
entro(D) # Entropy
finf(D) # Fisher Information Matrix
# List of all available moments
mom <- moments(D)
mom$mean # expectation
# ------------------
# Point Estimation
# ------------------
ll(D, x)
llbinom(x, N, p)
ebinom(x, size = N, type = "mle")
ebinom(x, size = N, type = "me")
mle(D, x)
me(D, x)
e(D, x, type = "mle")
# ------------------
# Estimator Variance
# ------------------
vbinom(N, p, type = "mle")
vbinom(N, p, type = "me")
avar_mle(D)
avar_me(D)
v(D, type = "mle")
Run the code above in your browser using DataLab