pgdraw.moments | R Documentation |
Compute exact first and second moments for the Polya-Gamma distribution
pgdraw.moments(b, c)
b |
The 'b' parameter of the Polya-Gamma distribution. |
c |
The 'c' parameter of the Polya-Gamma distribution. |
A list containing the mean and variance.
This code computes the exact mean and variance of the Polya-Gamma distribution for the specified parameters.
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
pgdraw
# ----------------------------------------------------------------- # 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.