# Parameter estimation for a distribution with known shape parameters
X <- rBeta_ab(n=500, shape1=2, shape2=5, a=1, b=2)
est.par <- eBeta_ab(X); est.par
plot(est.par)
# Fitted density curve and histogram
den.x <- seq(min(X),max(X),length=100)
den.y <- dBeta_ab(den.x,params = est.par)
hist(X, breaks=10, probability=TRUE, ylim = c(0,1.1*max(den.y)))
lines(den.x, den.y, col="blue") # Original data
lines(density(X), lty=2) # Fitted density curve
# Extracting boundary and shape parameters
est.par[attributes(est.par)$par.type=="boundary"]
est.par[attributes(est.par)$par.type=="shape"]
# Parameter Estimation for a distribution with unknown shape parameters
# Example from: Bury(1999) pp.261-262, parameter estimates as given by Bury are
# shape1 = 4.088, shape2 = 10.417, a = 1.279 and b = 2.407.
# The log-likelihood for this data and Bury's parameter estimates is 8.598672.
data <- c(1.73, 1.5, 1.56, 1.89, 1.54, 1.68, 1.39, 1.64, 1.49, 1.43, 1.68, 1.61, 1.62)
est.par <- eBeta_ab(X=data, method="numerical.MLE");est.par
plot(est.par)
# Estimates calculated by eBeta_ab differ from those given by Bury(1999).
# However, eBeta_ab's parameter estimates appear to be an improvement, due to a larger
# log-likelihood of 9.295922 (as given by lBeta_ab below).
# log-likelihood and score functions
lBeta_ab(data,param = est.par)
sBeta_ab(data,param = est.par)
Run the code above in your browser using DataLab