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
).
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, ...)
An R
list
is returned. This list should contain at least the following items.
The type of distribution in three character (minimum) format.
The parameters of the Govindarajulu distribution.
Attribute specifying source of the parameters.
A list of confirming the distribution support from quagov(c(0,1), gov)
where gov
are the final computed parameters before return.
A vector of the initial parameters actually passed to the optim
function to serve only as a reminder.
The returned list
of the optim()
function.
Helpful messages on the computations.
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
.
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.
Lower bounds for the distribution with default supposing that most often positive domain bounds might be of interest.
Upper bounds for the distribution, which must be specified.
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).
The type of location measure constraint.
The form of the objective function as previously described.
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).
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).
A logical to silence the try()
function wrapping the optim()
function.
A logical to trigger verbose output within the objective function.
Additional arguments to pass to the optim
function.
W.H. Asquith
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
.
disfitqua
, quagov