Implementation of forward selection based on cross-validated linear and logistic regression.

This package provides an implementation of forward selection based on linear and logistic regression which adopts cross-validation as a core component of the selection procedure.

Forward selection is an inherently slow approach, as for each variable a model needs to be fitted. In our implementation, this issue is further aggravated by the fact that an inner cross-validation happens at each iteration, with the aim of guiding the selection towards variables that have better generalization properties.

The code is parallelized over the inner folds, thanks to the `foreach`

package. User time therefore depends on the number of available cores, but
there is no advantage in using more cores than inner folds. A parallel
backend must be registered before starting, otherwise operations will run
sequentially with a warning reported. This can be done through a call to
`registerDoParallel()`

, for example.

The main advantage of forward selection is that it provides an immediately interpretable model, and the panel of variables obtained is in some sense the least redundant one, particularly if the number of variables to choose from is not too large (in our experience, up to about 30-40 variables).

However, when the number of variables is much larger than that, forward selection, besides being unbearably slow, may be more subject to overfitting, which is in the nature of its greedy-like design.

A precompiled package is available on CRAN.

First load the package and register a parallel cluster, setting the number of cores to use. If you are lucky enough to work on a large multicore machine, best performance is achieved by registering as many cores as the number of inner folds being used (the default is 30).

`library(nestfs)library(doParallel)registerDoParallel(10)`

To run forward selection from a baseline model that contains only age and sex, the following is enough:

`data(diabetes)fs.res <- forward.selection(X.diab, Y.diab, ~ age + sex, family=gaussian())summary(fs.res)`

By default, selection happens over all variables present in the data.frame
that are not part of the initial model. This can be controlled through the
`choose.from`

option.

It is possible to promote sparser selection by requesting a larger improvement
in log-likelihood (option `min.llk.diff`

, by default set to 0), or reducing the
number of iterations (option `max.iters`

, by default set to 15).

To obtain a cross-validated measure of performance of the selection process, nested forward selection should be run:

`cv.folds <- create.folds(10, nrow(X.diab), seed=1)nestfs.res <- nested.forward.selection(X.diab, Y.diab, ~ age + sex, family=gaussian(), folds=cv.folds)summary(nestfs.res)nested.performance(nestfs.res)`

- Silence messages output by newer versions of the pROC package.

- Changed maintainer email address.

- Use getfullname() if available also in summary.fs().
- Make nested.glm() accept a formula argument so that models with interaction terms can be specified. This also ensures that such models are fitted correctly in nested.forward.selection() after selection has been performed.
- Add the family field and assign a class to the object created by nested.glm().
- Add nested.performance() to compute the performance of cross-validated models as the area under the curve or the correlation coefficient.

- Document the default selection criterion.
- Correct the check for the verbose option in nested.forward.selection().
- Fix an error occurring in nested.forward.selection() when a categorical variable is selected.

- Make the univariate filter cope with non-matching names in filter.ignore.
- Parallelise the univariate filtering step.
- Add the verbose option to forward.selection().
- Return the coefficients of summary() instead of summary() itself from nested.glm().
- Swap family and folds in nested.glm() for consistency with other functions.
- Add tests for nested.glm().

- Close the parallel clusters at the end of the examples.
- Vectorize the computation of differences in log-likelihoods at iteration 1.
- First version on CRAN.

- Rewrite the examples to satisfy the CRAN upload request.
- Decrease the minimum number of inner folds to 5.

- Use family$dev.resids() to compute log-likelihoods.
- Fix forward.selection() when there's only one variable to choose from.
- Allow to specify variable names in the choose.from argument and not only indices.
- Allow more freedom in how the outcome variable can be specified for logistic regression.
- Rename parameters x.all, y.all and all.folds to x, y, and folds.
- Merge init.vars and init.model to make formulas a first class input type.
- Rework the diabetes dataset and save it in .rda format.
- Replace the doMC package with doParallel.
- Remove automatic registration of the parallel backend when attaching the package to pass checks on the R-devel win-builder machine.
- Add tests for forward.selection() and nested.forward.selection().

- Sort the indices of the test observations within each fold.
- Reorder some arguments of forward.selection() according to importance.
- Improve the argument checks in forward.selection().
- Let the family argument also be one of the family functions.
- Add tests for argument checks.

- Limit the variable names in the output to the length of the field.
- Clarify that the p-value from forward selection is a false discovery rate.
- Convert documentation to roxygen2 format.

- Check that the indices in the folds don't exceed the size of the dataset.
- Make the init.model option work in more cases.

- Check for missing values in the predictors and in the outcome variable.
- Return only the right-hand side of the formula in final.model from forward.selection().

- First version of the package.