Description Usage Arguments Details Value References See Also Examples
Low-level interface to all-variable-subsets selection in ordinary linear regression.
1 2 3 |
x |
|
y |
|
weights |
|
offset |
|
include |
|
exclude |
|
nmin |
|
nmax |
|
tolerance |
|
nbest |
|
... |
ignored |
pradius |
|
The best variable-subset model for every subset size is determined, where the "best" model is the one with the lowest residual sum of squares (RSS).
The regression data is specified with the x
, y
,
weights
, and offset
parameters. See
lm.fit()
for further details.
To force regressors into or out of the regression, a list of
regressors can be passed as an argument to the include
or
exclude
parameters, respectively.
The scope of the search can be limited to a range of subset sizes by
setting nmin
and nmax
, the minimum and maximum number of
regressors allowed in the regression, respectively.
A tolerance
vector can be specified to speed up the search,
where tolerance[j]
is the approximation tolerance applied to
subset models of size j
.
The number of submodels returned for each subset size is determined by
the nbest
parameter.
The preordering radius is given with the pradius
parameter.
A list
with the following components:
NOBS |
|
nobs |
|
nvar |
|
weights |
|
intercept |
|
include |
|
exclude |
|
size |
|
tolerance |
|
nbest |
|
submodel |
|
subset |
|
Hofmann M, Gatu C, Kontoghiorghes EJ, Colubi A, Zeileis A (2020). lmSubsets: Exact variable-subset selection in linear regression for R. Journal of Statistical Software, 93, 1–21. doi: 10.18637/jss.v093.i03.
lmSubsets()
for the high-level
interface
lmSelect_fit()
for best-subset
regression
1 2 3 4 5 6 7 | data("AirPollution", package = "lmSubsets")
x <- as.matrix(AirPollution[, names(AirPollution) != "mortality"])
y <- AirPollution[, names(AirPollution) == "mortality"]
f <- lmSubsets_fit(x, y)
f
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.