bicreg {BMA} | R Documentation |

## Bayesian Model Averaging for linear regression models.

### Description

Bayesian Model Averaging accounts for the model uncertainty inherent in the variable selection problem by averaging over the best models in the model class according to approximate posterior model probability.

### Usage

```
bicreg(x, y, wt = rep(1, length(y)), strict = FALSE, OR = 20,
maxCol = 31, drop.factor.levels = TRUE, nbest = 150)
```

### Arguments

`x` |
a matrix of independent variables |

`y` |
a vector of values for the dependent variable |

`wt` |
a vector of weights for regression |

`strict` |
logical. FALSE returns all models whose posterior model probability is within a factor of 1/OR of that of the best model. TRUE returns a more parsimonious set of models, where any model with a more likely submodel is eliminated. |

`OR` |
a number specifying the maximum ratio for excluding models in Occam's window |

`maxCol` |
a number specifying the maximum number of columns in the design matrix (including the intercept) to be kept. |

`drop.factor.levels` |
logical. Indicates whether factor levels can be individually dropped in the stepwise procedure to reduce the number of columns in the design matrix, or if a factor can be dropped only in its entirety. |

`nbest` |
a value specifying the number of models of each size returned to bic.glm by the leaps algorithm. The default is 150 (replacing the original default of 10). |

### Details

Bayesian Model Averaging accounts for the model uncertainty inherent in the variable selection problem by averaging over the best models in the model class according to the approximate posterior model probabilities.

### Value

`bicreg`

returns an object of class `bicreg`

The function 'summary' is used to print a summary of the results. The function 'plot' is used to plot posterior distributions for the coefficients.

An object of class `bicreg`

is a list containing at least the following components:

`postprob` |
the posterior probabilities of the models selected |

`namesx` |
the names of the variables |

`label` |
labels identifying the models selected |

`r2` |
R2 values for the models |

`bic` |
values of BIC for the models |

`size` |
the number of independent variables in each of the models |

`which` |
a logical matrix with one row per model and one column per variable indicating whether that variable is in the model |

`probne0` |
the posterior probability that each variable is non-zero (in percent) |

`postmean` |
the posterior mean of each coefficient (from model averaging) |

`postsd` |
the posterior standard deviation of each coefficient (from model averaging) |

`condpostmean` |
the posterior mean of each coefficient conditional on the variable being included in the model |

`condpostsd` |
the posterior standard deviation of each coefficient conditional on the variable being included in the model |

`ols` |
matrix with one row per model and one column per variable giving the OLS estimate of each coefficient for each model |

`se` |
matrix with one row per model and one column per variable giving the standard error of each coefficient for each model |

`reduced` |
a logical indicating whether any variables were dropped before model averaging |

`dropped` |
a vector containing the names of those variables dropped before model averaging |

`residvar` |
residual variance for each model |

`call` |
the matched call that created the bicreg object |

### Author(s)

Original Splus code developed by Adrian Raftery (raftery@uw.edu) and revised by Chris T. Volinsky. Translation to R by Ian Painter.

### References

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.

### See Also

`summary.bicreg`

, `print.bicreg`

, `plot.bicreg`

### Examples

```
library(MASS)
data(UScrime)
x<- UScrime[,-16]
y<- log(UScrime[,16])
x[,-2]<- log(x[,-2])
lma<- bicreg(x, y, strict = FALSE, OR = 20)
summary(lma)
plot(lma)
imageplot.bma(lma)
```

*BMA*version 3.18.17 Index]