The GENMOD Procedure |
Bayesian Analysis |
This section provides details for Bayesian analysis by Gibbs sampling in generalized linear models. See the section Gibbs Sampler for a general discussion of Gibbs sampling. See Gilks, Richardson, and Spiegelhalter (1996) for a discussion of applications of Gibbs sampling to a number of different models, including generalized linear models. In generalized linear models, the response has a probability distribution from a family of distributions of the exponential form. That is, the probability density of the response for continuous response variables, or the probability function for discrete responses, can be expressed as
for some functions , , and that determine the specific distribution. The canonical parameters depend only on the means of the response , which are related to the regression parameters through the link function . The additional parameter is the dispersion parameter. The GENMOD procedure estimates the regression parameters and the scale parameter by maximum likelihood. However, the GENMOD procedure can also provide Bayesian estimates of the regression parameters and either the scale , the dispersion , or the precision by Gibbs sampling. Except where noted, the following discussion applies to either , , or , although is used to illustrate the formulas. Note that the Poisson and binomial distributions do not have a dispersion parameter, and the dispersion is considered to be fixed at . The ASSESS, CONTRAST, ESTIMATE, OUTPUT, and REPEATED statements, if specified, are ignored. Also ignored are the PLOTS= option in the PROC GENMOD statement and the following options in the MODEL statement: ALPHA=, CORRB, COVB, TYPE1, TYPE3, SCALE=DEVIANCE (DSCALE), SCALE=PEARSON (PSCALE), OBSTATS, RESIDUALS, XVARS, PREDICTED, DIAGNOSTICS, and SCALE= for Poisson and binomial distributions. The multinomial and zero-inflated Poisson distributions are not available for Bayesian analysis.
Let be the parameter vector. For generalized linear models, the s are the regression coefficients s and the dispersion parameter . Let be the likelihood function, where is the observed data. Let be the prior distribution. The full conditional distribution of is proportional to the joint distribution; that is,
For instance, the one-dimensional conditional distribution of given , is computed as
Suppose you have a set of arbitrary starting values . Using the ARMS (adaptive rejection Metropolis sampling) algorithm of Gilks and Wild (1992) and Gilks, Best, and Tan (1995), you can do the following:
draw from
draw from
draw from
This completes one iteration of the Gibbs sampler. After one iteration, you have . After iterations, you have . PROC GENMOD implements the ARMS algorithm provided by Gilks (2003) to draw a sample from a full conditional distribution. See the section Assessing Markov Chain Convergence for information about assessing the convergence of the chain of posterior samples.
You can output these posterior samples into a SAS data set through ODS. The following SAS statement outputs the posterior samples into the SAS data set Post:
OUTPOST=Post
The data set also includes the variable LogPost, representing the log of the posterior log likelihood.
The model parameters are the regression coefficients and the dispersion parameter (or the precision or scale), if the model has one. The priors for the dispersion parameter and the priors for the regression coefficients are assumed to be independent, while you can have a joint multivariate normal prior for the regression coefficients.
The gamma distribution has a PDF
where is the shape parameter and is the inverse-scale parameter. The mean is and the variance is .
The joint prior density is given by
The inverse gamma distribution has a PDF
where is the shape parameter and is the scale parameter. The mean is if , and the variance is if .
Let be the regression coefficients.
The joint prior density is given by
where is the Fisher information matrix for the model. If the underlying model has a scale parameter (for example, a normal linear regression model), then the Fisher information matrix is computed with the scale parameter set to a fixed value of one.
If you specify the CONDITIONAL option, then Jeffreys’ prior, conditional on the current Markov chain value of the generalized linear model precision parameter , is given by
where is the model precision parameter.
See Ibrahim and Laud (1991) for a full discussion, with examples, of Jeffreys’ prior for generalized linear models.
Assume has a multivariate normal prior with mean vector and covariance matrix . The joint prior density is given by
If you specify the CONDITIONAL option, then, conditional on the current Markov chain value of the generalized linear model precision parameter , the joint prior density is given by
The joint prior density is given by
Let be the model parameters at iteration of the Gibbs sampler and let LL() be the corresponding model log likelihood. PROC GENMOD computes the following fit statistics defined by Spiegelhalter et al. (2002):
Effective number of parameters:
Deviance information criterion (DIC):
where
PROC GENMOD uses the full log likelihoods defined in the section Log-Likelihood Functions, with all terms included, for computing the DIC.
Denote the observed data by .
The posterior distribution is
where is the likelihood function with regression coefficients as parameters.
When the BAYES statement is specified, PROC GENMOD generates one Markov chain containing the approximate posterior samples of the model parameters. Additional chains are produced when the Gelman-Rubin diagnostics are requested. Starting values (or initial values) can be specified in the INITIAL= data set in the BAYES statement. If INITIAL= option is not specified, PROC GENMOD picks its own initial values for the chains.
Denote as the integral value of x. Denote as the estimated standard error of the estimator .
For the first chain that the summary statistics and regression diagnostics are based on, the default initial values are estimates of the mode of the posterior distribution. If the INITIALMLE option is specified, the initial values are the maximum likelihood estimates; that is,
Initial values for the th chain () are given by
with the plus sign for odd and minus sign for even .
Let be the generalized linear model parameter you choose to sample, either the dispersion, scale, or precision parameter. Note that the Poisson and binomial distributions do not have this additional parameter.
For the first chain that the summary statistics and regression diagnostics are based on, the default initial values are estimates of the mode of the posterior distribution. If the INITIALMLE option is specified, the initial values are the maximum likelihood estimates; that is,
The initial values of the th chain () are given by
with the plus sign for odd and minus sign for even .
The OUTPOST= data set contains the generated posterior samples. There are 2+ variables, where is the number of model parameters. The variable Iteration represents the iteration number and the variable LogPost contains the log posterior likelihood values. The other variables represent the draws of the Markov chain for the model parameters.
Copyright © 2009 by SAS Institute Inc., Cary, NC, USA. All rights reserved.