View source: R/VariableSelection.R
predict.BranchGLMVS | R Documentation |
Obtains predictions from BranchGLMVS or summary.BranchGLMVS objects.
## S3 method for class 'BranchGLMVS'
predict(object, which = 1, ...)
## S3 method for class 'summary.BranchGLMVS'
predict(object, which = 1, ...)
object |
a |
which |
a positive integer to indicate which model to get predictions from, the default is 1 which is used for the best model. For the branch and bound algorithms the number k is used for the kth best model and for the stepwise algorithms the number k is used for the model that is k - 1 steps away from the final model. |
... |
further arguments passed to predict.BranchGLM. |
A numeric vector of predictions.
predict.BranchGLM
Data <- iris
Fit <- BranchGLM(Sepal.Length ~ ., data = Data,
family = "gamma", link = "log")
# Doing branch and bound selection
VS <- VariableSelection(Fit, type = "branch and bound", metric = "BIC",
bestmodels = 10, showprogress = FALSE)
## Getting predictions from best model
predict(VS, which = 1)
## Getting linear predictors from 5th best model
predict(VS, which = 5, type = "linpreds")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.