mlEstimationTruncDist {TruncExpFam}R Documentation

ML Estimation of Distribution Parameters

Description

ML-estimation of the parameters of the distribution of the specified family, truncated at y.min and y.max

Usage

mlEstimationTruncDist(
  y,
  y.min = attr(y, "truncation_limits")$a,
  y.max = attr(y, "truncation_limits")$b,
  tol = 1e-05,
  max.it = 100,
  delta = 0.33,
  print.iter = 0,
  ny = 100,
  family = NULL,
  ...
)

Arguments

y

Sequence spanning the domain of the truncated distribution

y.min

Lower bound for y

y.max

Upper bound for y

tol

Error tolerance for parameter estimation

max.it

Maximum number of iterations

delta

Indirectly, the difference between consecutive iterations to compare with the error tolerance

print.iter

Determines the frequency of printing (i.e., prints every print.iter iterations)

ny

size of intermediate y range sequence. Higher values yield better estimations but slower iterations

family

distribution family to use

...

other parameters passed to subfunctions

Details

If print.iter = TRUE, the function prints the iteration, the sum of squares of delta.eta.j (delta.L2), and the current parameter estimates. The delta argument of this function is a factor in the calculation of delta.eta.j, which in turn is a factor in the calculation of delta.L2.

Value

A vector of class trunc_* containing the maximum-likelihood estmation of the underlying distribution * parameters.

Author(s)

René Holst

References

Inspired by Salvador: Pueyo: "Algorithm for the maximum likelihood estimation of the parameters of the truncated normal and lognormal distributions"

Examples

sample_size <- 1000
# Normal
sample.norm <- rtrunc(n = sample_size, mean = 2, sd = 1.5, a = -1)
mlEstimationTruncDist(
  sample.norm,
  y.min = -1, max.it = 500, delta = 0.33,
  print.iter = TRUE
)

# Log-Normal
sample.lognorm <- rtrunc(
  n = sample_size, family = "lognormal", meanlog = 2.5, sdlog = 0.5, a = 7
)
ml_lognormal <- mlEstimationTruncDist(
  sample.lognorm,
  y.min = 7, max.it = 500, tol = 1e-10, delta = 0.3,
  print.iter = FALSE
)
ml_lognormal

# Poisson
sample.pois <- rtrunc(
 n = sample_size, lambda = 10, a = 4, family = "Poisson"
)
mlEstimationTruncDist(
  sample.pois,
  y.min = 4, max.it = 500, delta = 0.33,
  print.iter = 5
)

# Gamma
sample.gamma <- rtrunc(
 n = sample_size, shape = 6, rate = 2, a = 2, family = "Gamma"
)
mlEstimationTruncDist(
  sample.gamma,
  y.min = 2, max.it = 1500, delta = 0.3,
  print.iter = 10
)

# Negative binomial
sample.nbinom <- rtruncnbinom(
 sample_size, size = 50, prob = .3, a = 100, b = 120
)
mlEstimationTruncDist(sample.nbinom, r=10)

[Package TruncExpFam version 1.1.1 Index]