
predIntGamma(x, n.transmean = 1, k = 1, method = "Bonferroni",
pi.type = "two-sided", conf.level = 0.95, est.method = "mle",
normal.approx.transform = "kulkarni.powar")
predIntGammaAlt(x, n.transmean = 1, k = 1, method = "Bonferroni",
pi.type = "two-sided", conf.level = 0.95, est.method = "mle",
normal.approx.transform = "kulkarni.powar")
NA
), undefined (NaN
), and
infinite (Inf
, -Inf
) values are allowed but will be removed.k
future transformed means (see the DETAILS section for an explanation of
what the transformation is). The default value is n.transmean=1
(i.e., predictconf.level
.
The default value is k=1
.k
) is greater than 1. The possible values are "Bonferroni"
(approximate method based on Bonferonni inequality; the default),"two-sided"
(the default), "lower"
, and
"upper"
.conf.level=0.95
."mle"
(maximum likelihood; the default),
"bcmle"
(bias-corrected mle), "mme"
"kulkarni.powar"
(the default), "cube.root"
, and
"fourth.root"
. See the DETAILS section for more informaiton."estimate"
containing the estimated parameters,
the prediction interval, and other information. See estimate.object
for details.
In addition to the usual components contained in an object of class
"estimate"
, the returned value also includes two additional
components within the "interval"
component:n.transmean
supplied in the
call to predIntGamma
or predIntGammaAlt
.x
contains any missing (NA
), undefined (NaN
) or
infinite (Inf
, -Inf
) values, they will be removed prior to
performing the estimation.
The function predIntGamma
returns a prediction interval as well as
estimates of the shape and scale parameters.
The function predIntGammaAlt
returns a prediction interval as well as
estimates of the mean and coefficient of variation.
Following Krishnamoorthy et al. (2008), the prediction interval is
computed by:
predIntNorm
with the transformed data to
compute the prediction interval, and thennormal.approx.transform
determines which transformation is used.
The value normal.approx.transform="cube.root"
uses
the cube root transformation suggested by Wilson and Hilferty (1931) and used by
Krishnamoorthy et al. (2008) and Singh et al. (2010b), and the value
normal.approx.transform="fourth.root"
uses the fourth root transformation suggested
by Hawkins and Wixley (1986) and used by Singh et al. (2010b).
The default value normal.approx.transform="kulkarni.powar"
uses the "Optimum Power Normal Approximation Method" of Kulkarni and Powar (2010).
The "optimum" power $p$ is determined by:
predIntGamma
and predIntGammaAlt
the power $p$ is based on whatever estimate of
shape is used (e.g., est.method="mle"
, est.method="bcmle"
, etc.).
When the argument n.transmean
is larger than 1 (i.e., you are
constructing a prediction interval for future means, not just single
observations), in order to properly compare a future mean with the
prediction limits, you must follow these steps:
interval$normal.transform.power
(see the section VALUE below).GammaDist
, GammaAlt
, estimate.object
,
egamma
, predIntNorm
,
tolIntGamma
.# Generate 20 observations from a gamma distribution with parameters
# shape=3 and scale=2, then create a prediciton interval for the
# next observation.
# (Note: the call to set.seed simply allows you to reproduce this
# example.)
set.seed(250)
dat <- rgamma(20, shape = 3, scale = 2)
predIntGamma(dat)
#Results of Distribution Parameter Estimation
#--------------------------------------------
#
#Assumed Distribution: Gamma
#
#Estimated Parameter(s): shape = 2.203862
# scale = 2.174928
#
#Estimation Method: mle
#
#Data: dat
#
#Sample Size: 20
#
#Prediction Interval Method: exact using
# Kulkarni & Powar (2010)
# transformation to Normality
# based on mle of 'shape'
#
#Normal Transform Power: 0.246
#
#Prediction Interval Type: two-sided
#
#Confidence Level: 95%
#
#Number of Future Observations: 1
#
#Prediction Interval: LPL = 0.5371569
# UPL = 15.5313783
#--------------------------------------------------------------------
# Using the same data as in the previous example, create an upper
# one-sided prediction interval for the next three averages of
# order 2 (i.e., each mean is based on 2 future observations), and
# use the bias-corrected estimate of shape.
pred.list <- predIntGamma(dat, n.transmean = 2, k = 3,
pi.type = "upper", est.method = "bcmle")
pred.list
#Results of Distribution Parameter Estimation
#--------------------------------------------
#
#Assumed Distribution: Gamma
#
#Estimated Parameter(s): shape = 1.906616
# scale = 2.514005
#
#Estimation Method: bcmle
#
#Data: dat
#
#Sample Size: 20
#
#Prediction Interval Method: Bonferroni using
# Kulkarni & Powar (2010)
# transformation to Normality
# based on bcmle of 'shape'
#
#Normal Transform Power: 0.246
#
#Prediction Interval Type: upper
#
#Confidence Level: 95%
#
#Number of Future
#Transformed Means: 3
#
#Sample Size for
#Transformed Means: 2
#
#Prediction Interval: LPL = 0.00000
# UPL = 12.17404
#--------------------------------------------------------------------
# Continuing with the above example, assume the distribution shifts
# in the future to a gamma distribution with shape = 5 and scale = 2.
# Create 6 future observations from this distribution, and create 3
# means by pairing the observations sequentially. Note we must first
# transform these observations using the power 0.246, then compute the
# means based on the transformed data, and then transform the means
# back to the original scale and compare them to the upper prediction
# limit of 12.17
set.seed(427)
new.dat <- rgamma(6, shape = 5, scale = 2)
p <- pred.list$interval$normal.transform.power
p
#[1] 0.246
new.dat.trans <- new.dat^p
means.trans <- c(mean(new.dat.trans[1:2]), mean(new.dat.trans[3:4]),
mean(new.dat.trans[5:6]))
means <- means.trans^(1/p)
means
#[1] 11.74214 17.05299 11.65272
any(means > pred.list$interval$limits["UPL"])
#[1] TRUE
#----------
# Clean up
rm(dat, pred.list, new.dat, p, new.dat.trans, means.trans, means)
#--------------------------------------------------------------------
# Reproduce part of the example on page 73 of
# Krishnamoorthy et al. (2008), which uses alkalinity concentrations
# reported in Gibbons (1994) and Gibbons et al. (2009) to construct a
# one-sided upper 90% prediction limit.
predIntGamma(Gibbons.et.al.09.Alkilinity.vec, pi.type = "upper",
conf.level = 0.9, normal.approx.transform = "cube.root")
#Results of Distribution Parameter Estimation
#--------------------------------------------
#
#Assumed Distribution: Gamma
#
#Estimated Parameter(s): shape = 9.375013
# scale = 6.202461
#
#Estimation Method: mle
#
#Data: Gibbons.et.al.09.Alkilinity.vec
#
#Sample Size: 27
#
#Prediction Interval Method: exact using
# Wilson & Hilferty (1931) cube-root
# transformation to Normality
#
#Normal Transform Power: 0.3333333
#
#Prediction Interval Type: upper
#
#Confidence Level: 90%
#
#Number of Future Observations: 1
#
#Prediction Interval: LPL = 0.0000
# UPL = 85.3495
Run the code above in your browser using DataLab