pgdraw.moments {pgdraw}R Documentation

Compute exact first and second moments for the Polya-Gamma distribution, PG(b, c)

Description

Compute exact first and second moments for the Polya-Gamma distribution

Usage

pgdraw.moments(b, c)

Arguments

b

The 'b' parameter of the Polya-Gamma distribution.

c

The 'c' parameter of the Polya-Gamma distribution.

Value

A list containing the mean and variance.

Details

This code computes the exact mean and variance of the Polya-Gamma distribution for the specified parameters.

References

Jesse Bennett Windle Forecasting High-Dimensional, Time-Varying Variance-Covariance Matrices with High-Frequency Data and Sampling Polya-Gamma Random Variates for Posterior Distributions Derived from Logistic Likelihoods PhD Thesis, 2013

Bayesian Inference for Logistic Models Using Polya-Gamma Latent Variables Nicholas G. Polson, James G. Scott and Jesse Windle Journal of the American Statistical Association Vol. 108, No. 504, pp. 1339–1349, 2013

See Also

pgdraw

Examples

# -----------------------------------------------------------------
# Example: Simulated vs exact moments

u = matrix(1,1e6,1)
x = pgdraw(1,0.5*u)
mean(x)
var(x)
pgdraw.moments(1,0.5)

x = pgdraw(2,2*u)
mean(x)
var(x)
pgdraw.moments(2,2)



[Package pgdraw version 1.1 Index]