Description Usage Arguments Value Examples
This function returns the normalised difference between specified and required 5 and 95 percentiles of the inverse gamma distribution over the variance. The percentiles represent those of the required error, i.e. the root of the variance. For example, if the error of an observation is believed to be between 2 and 10, with 90
1 | Findalphabeta_invgamma(pars, p5, p95)
|
pars |
the shape and scale parameters (in that order) of the inverse-Gamma distribution |
p5 |
the 5 percentile of the desired error distribution |
p95 |
the 95 percentils of the desired error distribution |
A numeric which is a measure of the discrepancy between the inverse-Gamma distribution and the 5/95 percentiles.
1 2 3 4 5 6 7 8 | require(actuar)
# Find the an inverse-gamma distribution of the variance parameter corresponding to my prior belief of the error (sqrt(variance)) lying between p5=2, p95=10
initpars <- c(5,0.1)
hyp_pars <- optim(par=initpars,Findalphabeta_invgamma, p5=2, p95=10)
# Now simulate from an inverse Gamma with these parameters and verify quantiles
X <- rinvgamma(shape = hyp_pars$par[1], scale = hyp_pars$par[2],n=10000)
print( quantile( sqrt(X),c(0.05,0.95)))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.