cpef: Parameter estimation of Three-Parameter Exponential Family

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/cpef.R

Description

The function cpef numerically estimates a canonical parameter of the three-parameter exponential family of distributions that includes two different types of prior distributions (log-gamma and normal). See ‘Details’ and Lee 2013 for more information.

Usage

1
2
3
4
5
  cpef(y, hparam, apriori = c("lgamma", "normal"),
    ztrunc = FALSE,
    method = c("LA", "MH", "IS", "AQ", "AS"),
    verbose = FALSE, initrun = FALSE, start,
    control = list(), proposal = list())

Arguments

y

a numeric vector of length n.

hparam

a numeric vector of length 2 for apriori.

apriori

a character string of length 1 to specify a prior distribution; Defaults to normal. Alternative is lgamma.

method

a name of numerical method to be used for fitting the formula in the model. Five options of MH, LA, IS, AH, AS are available. See ‘Details’ for more information.

ztrunc

a logical value; Is the zero truncated?; Defaults to FALSE.

verbose

a logical value; Be more verbose about the process by displaying messages; Defaults to FALSE.

start

a starting value for a canonical parameter to be fitted.

initrun

a logical value; Would you like to run the function cpef for other numerical method in order to have the best guess about start?

control

a list of parameters for controlling the fitting process. See ‘Details’.

proposal

a list of parameters for controlling the fitting process. See ‘Details’.

Details

The function cpef stands for a three-parameter exponenital family of distributions of a parameter which is canonically parameterized. This family of distributions has a conjugacy of log-gamma and normal priors to a (zero-truncated) Poisson sampling model.

Numericall methods are implemented for both cases of ztrunc=TRUE and ztrunc=FALSE on this family of distributions that is a general form including both apriori=lgamma and apriori=normal.

LA (Laplace approximation) is the implementation of that in the study Tierney, Kass, and Kadane 1989. The correction const defaults to 2e1 (log-scaled value).

MH (Metropolis-Hasting algorithm) is the implementation of that in the study Chib and Greenberg 1995. nchains and nburns defaults to 2e3 and 5e2. Normal distribution with mu=log(mean(y)) and sigma=sd(y) is chosen for a proposal distribution to generate a candidate sample.

IS (Importance sampling) is the implementation of that in the study Denny 2001. ess (effective sample size) is computed with an importance sample of size n=1e3. cpef is recursively used with method=LA for having the best guess for a mean value mu of a proposal distribution.

AS (Analytic soluation) is available only and only if ztrunc=FALSE and apriori=lgamma.

AQ (Adaptive quadrture) is the direct integration approach in terms of the canonical parameter theta using the R function integrate on infinite interval.

Value

The list of components returned from cpef depends on what numerical method is employed. All input paramters are inherited. The commonly returned components are:

theta

The estimated canonical parameter of length 1.

ess

The effective sample size if method=IS.

sratio

The ratio of determinants of two hessian matrices if method=LA

accept.rate

The proportion of candidate samples that are accepted in the chain of length n=2e3 if method=MH.

Author(s)

Chel Hee Lee <gnustats@gmail.com>

References

Tierney L., Kass R. and Kadane J. (1989). “Fully Exponential Laplace Approximations to Expectations and Variances of Nonpositive Functions.” _Journal of the American Statistical Association_, *84*(407), pp. 710-716.

Chib S. and Greenberg E. (1995). “Understanding the Metropolis-Hastings Algorithm.” _The American Statistician_, *49*(4), pp. 327-335.

Denny M. (2001). “Introduction to importance sampling in rare-event simulations.” _European Journal of Physics_, *22*(4), pp. 403.

Lee (2013) “Imprecise inferential framework”, PhD thesis.

R Core Team (2013). R: A language and environment for statistical computing. R Foundation for Statistical Computing, Vienna, Austria. URL http://www.R-project.org/.

See Also

optim, integrate, update, model, iprior

Examples

1
2
3
4
5
## Not run: 
## try to change the options of numerical methods
cpef(y=rpois(1e5, 1), hparam=c(1,2), ztrunc=TRUE, method="LA")

## End(Not run)

ipeglim documentation built on May 2, 2019, 4:31 p.m.