Learn R Programming

DAAG (version 0.37)

bestset.noise: Best Subset Selection Applied to Noise

Description

Best subset selection applied to completely random noise. This function demonstrates how variable selection techniques in regression can often err in suggesting that more variables be included in a regression model than necessary.

Usage

bestset.noise(m=100, n=40)

Arguments

m
the number of observations to be simulated.
n
the number of predictor variables in the simulated model.

Value

  • bestset.noise returns a list obtained from the summary.lm function.

Details

A set of n predictor variables are simulated as independent standard normal variates, in addition to a response variable which is also independent of the predictors. The best three variable model relating the response to the predictors is selected using functions from the leaps package. (The leaps package must be installed in order for this function to work.)

See Also

lm

Examples

Run this code
require(leaps)
bestset.noise(20,6) # `best' 3-variable regression for 20 simulated observations 
                    # on 7 unrelated variables (including the response)

Run the code above in your browser using DataLab