R: Helper function for MC3.REG

For.MC3.REG {BMA} | R Documentation

## Helper function for MC3.REG

### Description

Helper function for MC3.REG which implements each step of the Metropolis-Hastings algorithm.

### Usage

    For.MC3.REG(i, g, Ys, Xs, PI, K, nu, lambda, phi, outs.list)

### Arguments

`i` | the current iteration number.
`g` | a list containing the current state and the history of the Markov-Chain. This list is in the same form as the return value (see the 'value' section below): M0.var a logical vector specifying the variables in the current model. M0.out a logical vector specifying the outliers in the current model. M0.1 a number representing the variables in the current model in binary form. M0.2 a number represnting the outliers in the current model in binary form. outcnt the number of potential outliers
`Ys` | the vector of scaled responses.
`Xs` | the matrix of scaled covariates.
`PI` | a hyperparameter indicating the prior probability of an outlier. The default values are 0.1 if the data set has less than 50 observations, 0.02 otherwise.
`K` | a hyperparameter indicating the outlier inflation factor
`nu` | regression hyperparameter. Default value is 2.58 if r2 for the full model is less than 0.9 or 0.2 if r2 for the full model is greater than 0.9.
`lambda` | regression hyperparameter. Default value is 0.28 if r2 for the full model is less than 0.9 or 0.1684 if r2 for the full model is greater than 0.9.
`phi` | regression hyperparameter. Default value is 2.85 if r2 for the full model is less than 0.9 or 9.2 if r2 for the full model is greater than 0.9.
`outs.list` | a vector of all potential outlier locations (e.g. `c(10,12)` means the 10th and 12th points are potential outliers). If `NULL` and if `outliers` is `TRUE`, then potential outliers are estimated using the `out.ltsreg` function.

### Details

This function implements a single Metropolis-Hastings step, choosing a proposal model, calculating the Bayes Factor between the current model and proposal model, and updating the current model to the proposal model if the step results in an update.

### Value

a list containing the current state and the history of the Markov-Chain, with components

`flag` | a 0/1 number specifying whether the previous Metropolis-Hastings step resulted in a changed state or not.
`big.list` | a matrix containing the history of the Markov-Chain. Each row represents a unique model (combination of variables and outliers). The first column is the set of variables in the model (in binary form), the second column is the set of outliers in the model (in binary form), the third column is the log-posterior for the model (up to a constant) and the fourth column is the number of times that model has been visited.
`M0.var` | a logical vector specifying the variables in the current model.
`M0.out` | a logical vector specifying the outliers in the current model.
`M0.1` | a number representing the variables in the current model in binary form.
`M0.2` | a number represnting the outliers in the current model in binary form.
`outcnt` | the number of potential outliers

### Note

The implementation here differs from the Splus implentation. The Splus implementation uses global variables to contain the state of the current model and the history of the Markov-Chain. This implentation passes the current state and history to the function and then returns the updated state.

### Author(s)

Jennifer Hoeting jah@AT@stat.colostate.edu with the assistance of Gary Gadbury. Translation from Splus to R by Ian Painter ian.painter@AT@gmail.com.

### References

Bayesian Model Averaging for Linear Regression Models Adrian E. Raftery, David Madigan, and Jennifer A. Hoeting (1997). Journal of the American Statistical Association, 92, 179-191.

A Method for Simultaneous Variable and Transformation Selection in Linear Regression Jennifer Hoeting, Adrian E. Raftery and David Madigan (2002). Journal of Computational and Graphical Statistics 11 (485-507)

A Method for Simultaneous Variable Selection and Outlier Identification in Linear Regression Jennifer Hoeting, Adrian E. Raftery and David Madigan (1996). Computational Statistics and Data Analysis, 22, 251-270

Earlier versions of these papers are available via the World Wide Web using the url: http://www.stat.colostate.edu/~jah/papers/

### See Also

`MC3.REG`, `MC3.REG.choose`, `MC3.REG.logpost`

[Package BMA version 3.18.9 Index]