betaDistEstimation: Nonlinear Parameter Estimation for Beta Distribution

View source: R/betaDistEstimation.R

betaDistEstimationR Documentation

Nonlinear Parameter Estimation for Beta Distribution

Description

This function perform a rough estimation of the shape parameters of beta distribution

Usage

betaDistEstimation(
  q,
  init.pars = c(1, 1),
  force.optim = FALSE,
  hessian = FALSE,
  method = "BFGS",
  gr = NULL,
  control = list(maxit = 500, abstol = (10^-8)),
  lower = -Inf,
  upper = Inf,
  seed = 123,
  ...
)

Arguments

q

prior probabilities

init.pars

initial parameter values. Defaults to alpha = 1 & beta = 1, which imply the parsimony pseudo-counts greater than zero.

force.optim

Whether to force the use of optim function for the parameter estimation. Default is FALSE.

hessian

if TRUE, the hessian of f at the minimum is returned.

method, control, lower, upper, gr

(Optional). In the case that nlm function fails, the methods, list of control parameters, and bounders to be used with optim to accomplish the parameter estimation.

control

(Optional). In the case that nlm function fails, a list of control parameters to be used with optim function (see function help: ?optim) accomplish the parameter estimation.

...

Further parameter for nlm function.

Details

In order to obtain the estimates for shape parameters of beta distribution, the squared of the difference between the empirical cumulative distribution function (ecdf) & the theoretical cdf is minimized using the Non-Linear Minimization function nlm 'stats' package.

If nlm function fails, then an estimation using optim function is tried.

Value

A list with components, which would vary depending on whether the estimation was performed with nlm or optim. In all the cases the list element carrying the estimated parameters values is named parameters.

Author(s)

Robersy Sanchez <https://genomaths.com>

See Also

betaBinPost and estimateDirichDist

Examples

### A random generation numerical values with Beta distribution
x1 <- rbeta(n = 1000, shape1 = 2, shape2 = 3)

### Parameter estimation with "nlm" function
betaDistEstimation(q = x1, gradtol = 1e-12, hessian = TRUE)

### Parameter estimation with "optim" function
betaDistEstimation(q = x1, force.optim = TRUE, hessian = TRUE)


genomaths/usefr documentation built on April 18, 2023, 3:35 a.m.