Description Usage Arguments Details Value Note Author(s) See Also Examples
Selection of best linear models by exhaustive search
1 2 3 4 5 6 7 8 9 10 11 12 | regrAllEqns(formula, data, weights = NULL, nbest = 50, nvmax = 20,
force.in = NULL, force.out = NULL, codes = NULL, really.big = FALSE,
...)
regrAllEqnsXtr(object, nbest=1, criterion="cp")
## S3 method for class 'regrAllEqns'
print(x, nbest = 20, criterion = "cp",
printcriteria = FALSE, printcodes = TRUE, ...)
## S3 method for class 'regrAllEqns'
plot(x, criterion = "cp", critrange = 10,
minnumber = 10, nbest=10, codes = x$codes, ncharhorizontal = 6,
col="blue", legend = TRUE, mar = 6, main = "", cex = 0.7*par("cex"),
cex.lab = par("cex.lab"), ...)
|
formula |
formula for the full model |
data |
data.frame where the variables are found |
weights |
weights for weighted LS estimation |
nbest |
number of equations to record for each size.
For |
nvmax |
maximum size of subsets to examine |
force.in |
formula for terms to be kept in all models |
force.out |
formula for terms to be excluded from all models |
codes |
codes for the terms to be used for identifying the equations in the result 'outmat' and in the plot. Preferably one letter each. |
really.big |
Must be TRUE to perform exhaustive search on more than 50 variables. |
criterion |
Criterion to be used to rank the equations and for the vertical axis in plotting. |
object, x |
result of |
printcriteria |
logicel: should the table of criteria be printed? |
printcodes |
logical: should the short codes for the terms (columns in the primary output 'outmat') be listed? |
critrange |
range of criterion that determines how many equations
will be used in plotting: those that are less than |
minnumber |
minimum number of equations shown; overrides
|
ncharhorizontal |
maximum length of string on margin 3 to be shown
horizontally. Use |
col |
color used for the equation identifiers in the plot |
legend |
logical: Should a list of short and long codes for terms
be shown as a legend? Alternatively, a position for the legend:
keyword like |
mar |
margins: either all 4 margins of the plot or 1 number for the top margin. |
main |
main title |
cex, cex.lab |
character expansion for codes in the plot and on the upper margin |
... |
Other arguments, to be passed to |
This is a wrapper function for function
regsubsets
od package leaps
.
When factors (and other multicolumn terms) occur in the full model,
it returns models that either include the factor or exclude it,
and avoids those that contain some, but not all dummy variables
related to it.
regrAllEqns
also provides convenient information for the
the plotting method.
The results of regsubsets
and its summary
, which
include the "avoided" eaquations, are also contained in the value.
regrAllEqns
returns a list, containing
which |
|
criteria |
|
codes |
|
force.in |
|
force.out |
|
outmat |
|
allsubsets |
|
obj |
see |
regrAllEqnsXtr
returns a formula or a list of formulas
(if nbest>1
).
plot.regrAllEqns
invisibly returns the coordinates
of the models used in the plot.
For further details and notes, see ?regsubsets
Werner A. Stahel
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | data(d.birthrates, package="plgraphics")
t.formula <- fertility ~ catholic + single24 + single49 + eAgric + eIndustry +
eCommerce + eTransport + eAdmin + gradeHigh + gradeLow + educHigh +
bornLocal + bornForeign + altitude + language
## altitude and language are factors
r.ae <- regrAllEqns(t.formula, data=d.birthrates, nbest=100,
really.big=TRUE)
names(r.ae)
showd(r.ae$which)
plot(r.ae, mar=9, ncharhorizontal=0, main="birthrates example",
legend="bottomright", xlim=c(4,20))
## extract the formula of the best model
( t.formula <- regrAllEqnsXtr(r.ae) )
## ... and fit it
regr(t.formula, data=d.birthrates)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.