Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

SL.lm

Wrapper for lm


Description

Wrapper for OLS via lm(), which may be faster than glm().

Usage

SL.lm(Y, X, newX, family, obsWeights, model = TRUE, ...)

Arguments

Y

Outcome variable

X

Training dataframe

newX

Test dataframe

family

Gaussian or binomial

obsWeights

Observation-level weights

model

Whether to save model.matrix of data in fit object. Set to FALSE to save memory.

...

Any remaining arguments, not used.

References

Fox, J. (2015). Applied regression analysis and generalized linear models. Sage Publications.

See Also

Examples

data(Boston, package = "MASS")
Y = Boston$medv
# Remove outcome from covariate dataframe.
X = Boston[, -14]

set.seed(1)

sl = SuperLearner(Y, X, family = gaussian(),
                  SL.library = c("SL.mean", "SL.lm"))

print(sl)

SuperLearner

Super Learner Prediction

v2.0-28
GPL-3
Authors
Eric Polley [aut, cre], Erin LeDell [aut], Chris Kennedy [aut], Sam Lendle [ctb], Mark van der Laan [aut, ths]
Initial release
2021-05-04

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.