| zlm {BMS} | R Documentation |
Used to fit the Bayesian normal-conjugate linear model with Zellner's g prior and mean zero coefficent priors. Provides an object similar to the lm class.
zlm(formula, data = NULL, subset = NULL, g = "UIP")
formula |
an object of class "formula" (or one that can be coerced to that class), such as a data.frame - cf. lm |
data |
an optional data.frame (or one that can be coerced to that class): cf. lm |
subset |
an optional vector specifying a subset of observations to be used in the fitting process. |
g |
specifies the hyperparameter on Zellner's g-prior for the regression coefficients.g="UIP" corresponds to g=N, the number of observations (default);
g="BRIC" corresponds to the benchmark prior suggested by Fernandez, Ley and Steel (2001), i.e g=max(N, K^2), where K is the total number of covariates;g="EBL" estimates a local empirical Bayes g-parameter (as in Liang et al. (2008));g="hyper" takes the 'hyper-g' prior distribution (as in Liang et al., 2008) with the default hyper-parameter a=3;
This hyperparameter can be adjusted (between 2<a<=4) by setting g="hyper=2.9", for instance.Alternatively, g="hyper=UIP" sets the prior expected value of the shrinkage factor equal to that of UIP (above), g="hyper=BRIC" sets it according to BRIC
|
zlm estimates the coefficents of the following model y = α + X β + ε where ε ~ N(0,σ^2) and X is the design matrix
The priors on the intercept α and the variance σ are improper: alpha propto 1, sigma propto σ^{-1}
Zellner's g affects the prior on coefficients: beta ~ N(0, σ^2 g (X'X)^{-1}).
Note that the prior mean of coefficients is set to zero by default and cannot be adjusted. Note moreover that zlm always includes an intercept.
Returns a list of class zlm that contains at least the following elements (cf. lm):
coefficients |
a named vector of posterior coefficient expected values |
residuals |
the residuals, that is response minus fitted values |
fitted.values |
the fitted mean values |
rank |
the numeric rank of the fitted linear model |
df.residual |
the residual degrees of freedom |
call |
the matched call |
terms |
the terms object used |
model |
the model frame used |
coef2moments |
a named vector of coefficient posterior second moments |
marg.lik |
the log marginal likelihood of the model |
gprior.info |
a list detailing information on the g-prior, cf. output value gprior.info in bms |
Stefan Zeugner
The representation follows Fernandez, C. E. Ley and M. Steel (2001): Benchmark priors for Bayesian model averaging. Journal of Econometrics 100(2), 381–427
See also http://bms.zeugner.eu for additional help.
The methods summary.zlm and predict.lm provide additional insights into zlm output.
The function as.zlm extracts a single out model of a bma object (as e.g. created throughbms).
Moreover, lm for the standard OLS object, bms for the application of zlm in Bayesian model averaging.
Check http://bms.zeugner.eu for additional help.
data(datafls) #simple example foo = zlm(datafls) summary(foo) #example with formula and subset foo2 = zlm(y~GDP60+LifeExp, data=datafls, subset=2:70) #basic model, omitting three countries summary(foo2)