fit: Fits GLMs for summary.BranchGLMVS and BranchGLMVS objects

View source: R/summaryBranchGLMVS.R

fit.BranchGLMVSR Documentation

Fits GLMs for summary.BranchGLMVS and BranchGLMVS objects

Description

Fits GLMs for summary.BranchGLMVS and BranchGLMVS objects

Usage

## S3 method for class 'BranchGLMVS'
fit(object, which = 1, keepData = TRUE, keepY = TRUE, useNA = FALSE, ...)

fit(object, ...)

## S3 method for class 'summary.BranchGLMVS'
fit(object, which = 1, keepData = TRUE, keepY = TRUE, useNA = FALSE, ...)

Arguments

object

a summary.BranchGLMVS or BranchGLMVS object.

which

a positive integer indicating which model to fit, the default is to fit the first model .

keepData

Whether or not to store a copy of data and design matrix, the default is TRUE. If this is FALSE, then the results from this cannot be used inside of VariableSelection.

keepY

Whether or not to store a copy of y, the default is TRUE. If this is FALSE, then the binomial GLM helper functions may not work and this cannot be used inside of VariableSelection.

useNA

Whether or not to use observations that had missing values in the full model, but not for this specific model. The default is FALSE.

...

further arguments passed to other methods.

Details

The information needed to fit the GLM is taken from the original information supplied to the VariableSelection function.

The fitted models do not have standard errors or p-values since these are biased due to the selection process.

Value

An object of class BranchGLM.

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)

## Getting summary of the process
Summ <- summary(VS)

## Getting the best model according to BIC
FinalModel <- fit(Summ, which = 1)
FinalModel

## Getting the 8th best model according to BIC
EighthModel <- fit(Summ, which = 8)
EighthModel


BranchGLM documentation built on Aug. 31, 2023, 5:17 p.m.