View source: R/variable_selection.R

BIC forward regression with generalised linear models | R Documentation |

BIC forward regression with generalised linear models.

```
bic.fs.reg(y, x, tol = 2, type = "logistic")
```

`y` |
A numerical vector. |

`x` |
A matrix with data, the predictor variables. |

`tol` |
If the BIC difference between two successive models is less than the tolerance value, the variable will not enter the model. |

`type` |
If you have a binary dependent variable, put "logistic". If you have count data, put "poisson". |

The forward regression tries one by one the variables using the BIC at each step for the latest variable. If the BIC of the regression model with that variable included, is less than "tol" from the previous model without this variable, the variable enters.

A matrix with two columns, the index of the selected variable(s) and the BIC of each model.

Marios Dimitriadis

R implementation and documentation: Marios Dimitriadis <kmdimitriadis@gmail.com>.

Draper, N.R. and Smith H. (1988). Applied regression analysis. New York, Wiley, 3rd edition.

```
fs.reg, bic.corfsreg, cor.fsreg, score.glms, univglms, logistic_only,
poisson_only, regression
```

```
x <- matrix(rnorm(200 * 50), ncol = 50)
## 200 variables, hence 200 univariate regressions are to be fitted
y <- rbinom(200, 1, 0.5)
a <- bic.fs.reg(y, x)
x <- NULL
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.