zlm | R Documentation |
Used to fit the Bayesian normal-conjugate linear model with Zellner's g
prior and mean zero coefficient 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. |
data |
an optional |
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. |
zlm
estimates the coefficients 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 |
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 |
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.