Learn R Programming

TukeyGH77 (version 0.1.4)

letterValue: Letter-Value Estimation of Tukey \(g\)-&-\(h\) Distribution

Description

Letter-value based estimation (Hoaglin, 1985) of Tukey \(g\)-, \(h\)- and \(g\)-&-\(h\) distribution. All equation numbers mentioned below refer to Hoaglin (1985).

Usage

letterValue(
  x,
  g_ = seq.int(from = 0.15, to = 0.25, by = 0.005),
  h_ = seq.int(from = 0.15, to = 0.35, by = 0.005),
  halfSpread = c("both", "lower", "upper"),
  ...
)

Value

Function letterValue() returns a 'letterValue' object, which is double

vector of estimates \((\hat{A}, \hat{B}, \hat{g}, \hat{h})\)

for a Tukey \(g\)-&-\(h\) distribution.

Arguments

x

double vector, one-dimensional observations

g_

double vector, probabilities used for estimating \(g\) parameter. Or, use g_ = FALSE to implement the constraint \(g=0\) (i.e., an \(h\)-distribution is estimated).

h_

double vector, probabilities used for estimating \(h\) parameter. Or, use h_ = FALSE to implement the constraint \(h=0\) (i.e., a \(g\)-distribution is estimated).

halfSpread

character scalar, either to use 'both' for half-spreads (default), 'lower' for half-spread, or 'upper' for half-spread.

...

additional parameters, currently not in use

Details

Unexported function letterV_g() estimates parameter \(g\) using equation (10) for \(g\)-distribution and the equivalent equation (31) for \(g\)-&-\(h\) distribution.

Unexported function letterV_B() estimates parameter \(B\) for Tukey \(g\)-distribution (i.e., \(g\neq 0\), \(h=0\)), using equation (8a) and (8b).

Unexported function letterV_Bh_g() estimates parameters \(B\) and \(h\) when \(g\neq 0\), using equation (33).

Unexported function letterV_Bh() estimates parameters \(B\) and \(h\) for Tukey \(h\)-distribution, i.e., when \(g=0\) and \(h\neq 0\), using equation (26a), (26b) and (27).

Function letterValue() plays a similar role as fitdistrplus:::start.arg.default, thus extends fitdistrplus::fitdist for estimating Tukey \(g\)-&-\(h\) distributions.

References

Hoaglin, D.C. (1985). Summarizing Shape Numerically: The \(g\)-and-\(h\) Distributions. tools:::Rd_expr_doi("10.1002/9781118150702.ch11")

Examples

Run this code
set.seed(77652); x = rGH(n = 1e3L, g = -.3, h = .1)
letterValue(x, g_ = FALSE, h_ = FALSE)
letterValue(x, g_ = FALSE)
letterValue(x, h_ = FALSE)
(m3 = letterValue(x))

library(fitdistrplus)
fit = fitdist(x, distr = 'GH', start = as.list.default(m3))
plot(fit) # fitdistrplus:::plot.fitdist

Run the code above in your browser using DataLab