Learn R Programming

lmomco (version 2.4.14)

disfitgovloc: Fit a Govindarajulu Distribution to Bounds and Location

Description

Fits a Govindarajulu distribution to specified lower and upper bounds and a given location measure (either mean and median). Fitting occurs through \(3\)-dimensional minimization using the optim function. Objective function forms are either root mean-square error (RMSE) or mean absolute deviation (MAD), and the objective functions are expected to result in slightly different estimates of distribution parameters. The RMSE form (\(\sigma_{\mathrm{RMSE}}\)) is defined as

$$\sigma_{\mathrm{RMSE}} = \biggl[ \frac{1}{3}\,\sum_{i=1}^3 \bigl[x_i - \hat{x}_i\bigr]^2\biggr]^{1/2}\mbox{,}$$

where \(x_i\) is a vector of the targeted lower bounds (lwr argument), location measure (loc argument), and upper bounds (upr argument), and \(\hat{x}_i\) is a similar vector of Govindarajulu properties for “current” iteration of the optimization. Similarly, the MAD form (\(\sigma_{\mathrm{MAD}}\)) is defined as

$$\sigma_{\mathrm{MAD}} = \frac{1}{3}\,\sum_{i=1}^3 \mid x_i - \hat{x}_i \mid \mbox{.}$$

The premise of this function is that situations might exist in practical applications wherein the user has an understanding or commitment to certain bounding conditions of a distribution. The user also has knowledge of a particular location measure (the mean or median) of a distribution. The bounded nature of the Govindarajulu might be particularly of interest because the quantile function (quagov) is explicit. The curvatures that the distribution can attain also provide it more flexibility to fitting to a given location measure than say the Triangular distribution (quatri).

Usage

disfitgovloc(x=NULL, loc=NULL, lwr=0, upr=NA, init.para=NULL,
             loctype=c("mean", "median"), objfun=c("rmse", "mad"),
             ptransf=function(p) return(log(p)),
             pretransf=function(p) return(exp(p)),
             silent=TRUE, verbose=FALSE, ...)

Value

An R

list is returned. This list should contain at least the following items.

type

The type of distribution in three character (minimum) format.

para

The parameters of the Govindarajulu distribution.

source

Attribute specifying source of the parameters.

supdist

A list of confirming the distribution support from quagov(c(0,1), gov) where gov are the final computed parameters before return.

init.para

A vector of the initial parameters actually passed to the optim function to serve only as a reminder.

optim

The returned list of the optim() function.

message

Helpful messages on the computations.

Arguments

x

Optional vector to help guide the initial parameter estimates for the optimization, if given and if loc=NULL, then loc by loctype will be computed from the x.

loc

Optional value for the location statistic, which if not given will be computed from mean or median of the x. The loc however can also be given if an x is given and at which point the user's setting prevails.

lwr

Lower bounds for the distribution with default supposing that most often positive domain bounds might be of interest.

upr

Upper bounds for the distribution, which must be specified.

init.para

Optional initial values for the parameters used for starting values for the optim function. If this argument is not set nor is x, then an unrigorous attempt is made to guess at the initial parameters using heuristics and the triangular quantile function (because the triangle is trivial and also bounded) (see sources).

loctype

The type of location measure constraint.

objfun

The form of the objective function as previously described.

ptransf

The parameter transformation function that is useful to guide the optimization run. The distribution requires its second and third parameters to be nonzero without constraint on the first parameter; however, the default treats the first parameter as also nonzero. This is potentially suboptimal for some situations (see Examples).

pretransf

The parameter retransformation function that is useful to guide the optimization run. The distribution requires its second and third parameters to be nonzero without constraint on the first parameter; however, the default treats the first parameter as also nonzero. This is potentially suboptimal for some situations (see Examples).

silent

A logical to silence the try() function wrapping the optim() function.

verbose

A logical to trigger verbose output within the objective function.

...

Additional arguments to pass to the optim function.

Author

W.H. Asquith

Details

Support of the Govindarajulu for the optimized parameter set is computed by internally and reported as part of the returned values. This enhances the documentation a bit more---the computed parameters might not always have full convergence and result in slightly difference bounds than targeted. Finally, this function was developed using some heredity to disfitqua.

See Also

disfitqua, quagov