gets.lm: General-to-Specific (GETS) Modelling 'lm' objects

View source: R/gets-lm-source.R

gets.lmR Documentation

General-to-Specific (GETS) Modelling 'lm' objects

Description

General-to-Specific (GETS) Modelling of objects of class lm.

Usage

## S3 method for class 'lm'
gets(x, keep = NULL, include.1cut = TRUE, print.searchinfo = TRUE, ...) 

Arguments

x

an object of class 'lm', see lm

keep

NULL or a vector of integers that determines which regressors to be excluded from removal in the specification search

include.1cut

logical. If TRUE (default), then the 1-cut model is added to the list of terminal models. If FALSE, then the 1-cut is not added, unless it is a terminal model in one of the paths

print.searchinfo

logical. If TRUE (default), then selected info is printed during search

...

further arguments passed on to getsFun

Details

Internally, gets.lm invokes getsFun for the GETS-modelling, which is also invoked by getsm. See their help pages for more information.

Value

A list of class lm. Note that the 'top' of the list contains information (paths and terminal models) from the GETS modelling, see paths and terminals

Author(s)

Genaro Sucarrat, http://www.sucarrat.net/

See Also

lm, getsFun, getsm, paths and terminals

Examples


##generate some data:
set.seed(123) #for reproducibility
y <- rnorm(30) #generate Y
x <- matrix(rnorm(30*10), 30, 10) #matrix of Xs
colnames(x) <- paste0("var", 1:NCOL(x))

##estimate model:
mymod <- lm(y ~ x)

##do gets modelling:
gets(mymod)

##ensure intercept is not removed:
gets(mymod, keep=1)


gets documentation built on Oct. 10, 2022, 1:06 a.m.