# -----------------------------------------------------
# Geom Distribution Example
# -----------------------------------------------------
# Create the distribution
p <- 0.4
D <- Geom(p)
# ------------------
# dpqr Functions
# ------------------
d(D, 0:4) # density function
p(D, 0:4) # 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
median(D) # Median
mode(D) # Mode
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)
llgeom(x, p)
egeom(x, type = "mle")
egeom(x, type = "me")
mle(D, x)
me(D, x)
e(D, x, type = "mle")
mle("geom", x) # the distr argument can be a character
# ------------------
# Estimator Variance
# ------------------
vgeom(p, type = "mle")
vgeom(p, type = "me")
avar_mle(D)
avar_me(D)
v(D, type = "mle")
Run the code above in your browser using DataLab