# NOT RUN {
#fitting exponential data without initial values (Spinelli 2001)
breaks <- c(0, 2, 6, 10, 14, 18, 22, 26)
counts <- c(21, 9, 5, 2, 1, 1, 0)
(mle1 <- distrFit(breaks, counts, distr = "exp"))
#fitting generated data with initial values
breaks <- seq(0, 40, 2)
counts <- table(cut(rweibull(200, 0.5, 3), breaks))
(mle2 <- distrFit(breaks, counts, distr = "weibull", initials = c(0.5, 3)))
#fitting generated data to a different distribution
breaks <- seq(-100, 100, 5)
counts <- table(cut(rcauchy(500, -20, 10), breaks))
(mle3 <- distrFit(breaks, counts, distr = "norm"))
# }
Run the code above in your browser using DataLab