Findalphabeta_beta: Quantile difference when tuning Beta distribution...

Description Usage Arguments Value Examples

View source: R/genericfns.R

Description

This function returns the normalised difference between specified and required 95 percentiles of the Beta distribution. This function can then be passed to an optimisation routine to find required parameter values.

Usage

1
Findalphabeta_beta(pars, p95)

Arguments

pars

the two shape parameters of the Beta distribution

p95

the desired 95 percentile

Value

A numeric which is a measure of the discrepancy between the desired and real 95 percentile.

Examples

1
2
3
4
5
6
7
8
require(actuar)
initpars <- c(2,6)
hyp  = optim(par=c(2,6),Findalphabeta_beta, p95=0.12)
hyp_shape1 <- hyp$par[1]
hyp_shape2 <- hyp$par[2]
# Now simulate from a Beta with these parameters and verify quantiles
X <- rbeta(shape1 = hyp_shape1, shape2 = hyp_shape2,n=10000)
print(quantile(X,0.95))

shazhe/mvst0 documentation built on May 29, 2019, 9:20 p.m.