a string indicating the error family to use. Currently "gaussian", "gamma", "inverse gaussian", "binomial" and "poisson" are implemented.
link
a string indicating the link to use. Currently "identity", "log", "logit", "probit", "sqrt", "inverse" and "loglog" are implemented.
scale
the scale factor for the model. May be either a numeric constant or a string specifying the estimation, either "deviance" or "pearson". The default value is 1 for "binomial" and "poisson" error structures, and "pearson" for the others.
models
an optional matrix representing the models to be averaged over.
models is a n x p matrix in which each row represents a model.
The corresponding entry in the row is 1 if that variable is included in the model; 0 if not.
The default value is NULL which will cause glib to call bic.glm with the parameter occam.window set to FALSE to obtain the models to average over.
phi
a vector of phi values. Default: 1.
psi
a scalar prior parameter. Default: 1.
nu
a scalar prior parameter. Default: 0
pmw
a vector of prior model weights. These must be positive, but do not have to sum to one.
The prior model probabilities are given by pmw/sum(pmw).
The default is a vector of 1's of length nrow(models)
glimest
a logical value specifying whether to output estimates and standard errors for each model.
glimvar
a logical value specifying whether glim variance matrices are output for each model.
output.priorvar
a logical value specifying whether the prior variance is output for each model and value of phi combination.
post.bymodel
a logical value specifying whether to output the posterior mean and sd for each model and value of phi combination.
output.postvar
a logical value specifying whether to output the posterior variance matrix for each model and value of phi combination.
priormean
an optional vector of length p+1 containing a user specified prior mean on the variables (including the intercept),
where p=number of independent variables.
priorvar
an optional matrix containing a user specified prior variance matrix, a (p+1) x (p+1) matrix.
Default has the prior variance estimated as in Raftery(1996).
nbest
an integer giving the number of best models of each size to be returned by bic.glm if models == NULL
call
the call to the function
index.phi
an index to the value of phi to use when converting a glib object to a bic.glm object
...
unused
Details
Function to evaluate Bayes factors and account for model
uncertainty in generalized linear models.
This also calculates posterior distributions from a set of reference
proper priors.
as.bic.glm creates a 'bic.glm' object from a 'glib' object.
Value
glib returns an object of type glib, which is a list
containing the following items:
inputs
a list echoing the inputs
(x,y,n,error,link,models,phi,psi,nu)
bf
a list containing the model comparison results:
twologB10
an nmodel x nphi matrix whose
[i,j] element is 2logB10 for model i against the null model
with phi=phi[j]. A Laplace approximation (one-step Newton)
is used.
postprob
a matrix containing the posterior probabilities
of the models for each value of phi.
deviance
a vector containing the deviances for the models.
chi2
a vector containing the (DV0-DV1)/scale for the models
npar
a vector containing the number of parameters estimated
for each model.
scale
the estimated or assigned scale used
posterior
a list containing the Bayesian model mixing results:
prob0
an ncol(x) x nphi matrix whose [k,j]
element is the posterior probability that the
parameter corresponding to the k-th column of x is zero,
for the j-th value of phi.
mean
a ncol(x) x nphi matrix whose [k,j]
element is the posterior mean of the parameter corresponding to
the k-th column of x, for the j-th value of phi.
sd
as for mean, but for the posterior standard deviation.
NOTE: Both mean and sd are CONDITIONAL on the parameter being
non-zero. They do not include the intercept.
glim.est
a list containing the GLIM estimates for the different
models:
coef
An nmodel-list, each of whose elements is the coef
value from "glim" for one of the models.
se
as coef, but contains standard errors.
var
as coef, but contains variance matrices of the
estimates.
posterior.bymodel
a list containing model-specific posterior
means and sds:
mean
a list with nmodel elements, whose ith element
is a npar[i]xnphi matrix, containing the posterior means of
the npar[i] parameters of model i, for each value of phi.
sd
as for mean, but for posterior standard deviations.
var
a list with nmodel elements, whose ith element
is a npar[i] by npar[i] by nphi array,
containing the posterior variance matrix of the parameters of
model i for each value of phi.
prior
a list containing the prior distributions:
mean
prior mean for the biggest model
(this doesn't depend on phi)
var
similar to corresponding member of posterior.bymodel.
models
an array containing the models used.
glm.out
an object of type 'bic.glm' containing the results of
any call to bic.glm
call
the call to the function
Note
The outputs controlled by glimvar, output.priorvar and output.postvar can take up a lot of space,
which is why these control parameters are F by default.
Author(s)
Original Splus code developed by Adrian Raftery raftery@AT@stat.washington.edu and revised by Chris T. Volinsky. Translation to R by Ian S. Painter.
References
Raftery, A.E. (1988). Approximate Bayes factors for generalized linear models. Technical Report no. 121, Department of Statistics, University of Washington.
Raftery, Adrian E. (1995). Bayesian model selection in social research (with Discussion). Sociological Methodology 1995 (Peter V. Marsden, ed.), pp. 111-196, Cambridge, Mass.: Blackwells.
Raftery, A.E. (1996). Approximate Bayes factors and accounting for model uncertainty in generalized linear models. Biometrika (83: 251-266).