Learn R Programming

gets (version 0.38)

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

Description

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

Usage

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

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

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

Author

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

Details

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

See Also

lm, getsFun, getsm, paths and terminals

Examples

Run this code

##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)

Run the code above in your browser using DataLab