zlm {BMS} | R Documentation |

## Bayesian Linear Model with Zellner's g

### Description

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.

### Usage

```
zlm(formula, data = NULL, subset = NULL, g = "UIP")
```

### Arguments

`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. |

### Details

`zlm`

estimates the coefficients of the following model ```
y = \alpha
+ X \beta + \epsilon
```

where `\epsilon`

~ `N(0,\sigma^2)`

and `X`

is the design matrix

The priors on the intercept `\alpha`

and the
variance `\sigma`

are improper: `alpha \propto 1`

, ```
sigma
\propto \sigma^{-1}
```

Zellner's g affects the prior on coefficients:
`beta`

~ `N(0, \sigma^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.

### Value

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 |

### Author(s)

Stefan Zeugner

### References

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.

### See Also

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 through`bms`

).

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.

### Examples

```
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)
```

*BMS*version 0.3.5 Index]