Last data update: 2014.03.03

R: Tail Probability Estimation for a Gamma Shape Mixture Model
predict-methodsR Documentation

Tail Probability Estimation for a Gamma Shape Mixture Model

Description

predict method for class "gsm". This function allows to estimate the tail probability of a Gamma Shape Mixture Model using the output of the estim.gsm or estim.gsm_theta procedures.

Usage

## S4 method for signature 'gsm'
predict(object, thresh, start = 1, ...)

Arguments

object

object of class "gsm"; a list returned by the estim.gsm or estim.gsm_theta functions.

thresh

threshold value.

start

MCMC run to start from.

...

further arguments passed to or from other methods.

Details

The tail probability is estimated by applying the standard Rao-Blackwellized estimator on the Gibbs sampling realizations obtained through the estim.gsm or estim.gsm_theta procedures.

Value

A numerical vector containing the posterior draws for the tail probability exceeding the value of thresh.

Author(s)

Sergio Venturini sergio.venturini@unibocconi.it

References

Venturini, S., Dominici, F. and Parmigiani, G. (2008), "Gamma shape mixtures for heavy-tailed distributions". Annals of Applied Statistics, Volume 2, Number 2, 756–776. http://projecteuclid.org/euclid.aoas/1215118537

See Also

estim.gsm, estim.gsm_theta, predict-methods, plot-methods.

Examples

set.seed(2040)
y <- rgsm(500, c(.1, .3, .4, .2), 1)
burnin <- 5
mcmcsim <- 10
J <- 250
gsm.out <- estim.gsm(y, J, 300, burnin + mcmcsim, 6500, 340, 1/J)
thresh <- c(0.1, 0.5, 0.75, 1, 2)
tail.prob.est <- tail.prob.true <- rep(NA, length(thresh))
for (i in 1:length(thresh)){
   tail.prob.est[i] <- mean(predict(gsm.out, thresh[i]))
   tail.prob.true[i] <- sum(y > thresh[i])/length(y)
}
qqplot(tail.prob.true, tail.prob.est, main = "Q-Q plot of true vs. estimated tail probability")
abline(0, 1, lty = 2)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(GSM)
Loading required package: gtools
Package GSM (1.3.2) loaded.
To cite, see citation("GSM")

> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/GSM/predict-methods.Rd_%03d_medium.png", width=480, height=480)
> ### Name: predict-methods
> ### Title: Tail Probability Estimation for a Gamma Shape Mixture Model
> ### Aliases: predict-methods predict,ANY-method predict,gsm-method
> ### Keywords: methods
> 
> ### ** Examples
> 
> set.seed(2040)
> y <- rgsm(500, c(.1, .3, .4, .2), 1)
> burnin <- 5
> mcmcsim <- 10
> J <- 250
> gsm.out <- estim.gsm(y, J, 300, burnin + mcmcsim, 6500, 340, 1/J)
> thresh <- c(0.1, 0.5, 0.75, 1, 2)
> tail.prob.est <- tail.prob.true <- rep(NA, length(thresh))
> for (i in 1:length(thresh)){
+    tail.prob.est[i] <- mean(predict(gsm.out, thresh[i]))
+    tail.prob.true[i] <- sum(y > thresh[i])/length(y)
+ }
> qqplot(tail.prob.true, tail.prob.est, main = "Q-Q plot of true vs. estimated tail probability")
> abline(0, 1, lty = 2)
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>