plot.BranchGLMVS {BranchGLM} | R Documentation |
Plot Method for summary.BranchGLMVS and BranchGLMVS Objects
Description
Creates plots to help visualize variable selection results from BranchGLMVS or summary.BranchGLMVS objects.
Usage
## S3 method for class 'BranchGLMVS'
plot(
x,
ptype = "both",
marnames = 7,
addLines = TRUE,
type = "b",
horiz = FALSE,
cex.names = 1,
cex.lab = 1,
cex.axis = 1,
cex.legend = 1,
cols = c("deepskyblue", "indianred", "forestgreen"),
...
)
## S3 method for class 'summary.BranchGLMVS'
plot(
x,
ptype = "both",
marnames = 7,
addLines = TRUE,
type = "b",
horiz = FALSE,
cex.names = 1,
cex.lab = 1,
cex.axis = 1,
cex.legend = 1,
cols = c("deepskyblue", "indianred", "forestgreen"),
...
)
Arguments
x |
a |
ptype |
the type of plot to produce, look at details for more explanation. |
marnames |
a numeric value used to determine how large to make margin of axis with variable names, this is only for the "variables" plot. If variable names are cut-off, consider increasing this from the default value of 7. |
addLines |
a logical value to indicate whether or not to add black lines to separate the models for the "variables" plot. This is typically useful for smaller amounts of models, but can be annoying if there are many models. |
type |
what type of plot to draw for the "metrics" plot, see more details at plot.default. |
horiz |
a logical value to indicate whether models should be displayed horizontally for the "variables" plot. |
cex.names |
how big to make variable names in the "variables" plot. |
cex.lab |
how big to make axis labels. |
cex.axis |
how big to make axis annotation. |
cex.legend |
how big to make legend labels. |
cols |
the colors used to create the "variables" plot. Should be a character vector of length 3, the first color will be used for included variables, the second color will be used for excluded variables, and the third color will be used for kept variables. |
... |
further arguments passed to plot.default for the "metrics" plot and image.default for the "variables" plot. |
Details
The different values for ptype are as follows
"metrics" for a plot that displays the metric values ordered by rank for the branch and bound algorithms or a plot which displays the metric values in the path taken by the stepwise algorithms
"variables" for a plot that displays which variables are in each of the top models for the branch and bound algorithms or a plot which displays the path taken by the stepwise algorithms
"both" for both plots
If there are so many models that the "variables" plot appears to be entirely black, then set addLines to FALSE.
Value
This only produces plots, nothing is returned.
Examples
Data <- iris
Fit <- BranchGLM(Sepal.Length ~ ., data = Data, family = "gaussian", link = "identity")
# Doing branch and bound selection
VS <- VariableSelection(Fit, type = "branch and bound", metric = "BIC", bestmodels = 10,
showprogress = FALSE)
VS
## Getting summary of the process
Summ <- summary(VS)
Summ
## Plotting the BIC of best models
plot(Summ, type = "b", ptype = "metrics")
## Plotting the BIC of the best models
plot(Summ, ptype = "variables")
### Alternative colors
plot(Summ, ptype = "variables",
cols = c("yellowgreen", "purple1", "grey50"))
### Smaller text size for names
plot(Summ, ptype = "variables", cex.names = 0.75)