Description Usage Arguments Value Examples
This function returns the normalised difference between specified and required 5 and 95 percentiles of the Gamma distribution. 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 1 and 5, with 90
1 | Findalphabeta_gamma(pars, p5, p95)
|
pars |
the shape and rate parameters (in that order) of the 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 Gamma distribution over the precision and the 5/95 percentiles of the error.
1 2 3 4 5 6 7 8 | require(actuar)
# Find the Gamma distribution over the precision corresponding to my prior belief of the error (1/sqrt(precision)) lying between p5=2, p95=10
initpars <- c(5,0.1)
hyp_pars <- optim(par=initpars,Findalphabeta_gamma, p5=1, p95=5)
# Now simulate from a Gamma with these parameters and verify quantiles
X <- rgamma(shape = hyp_pars$par[1], rate = hyp_pars$par[2],n=10000)
print( quantile(1/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.