Skip to content
Prev 56137 / 63424 Next

Documentation examples for lm and glm

A pragmatic solution could be to create a simple linear regression example 
with variables in the global environment and then another example with a 
data.frame.

The latter might be somewhat more complex, e.g., with several regressors 
and/or mixed categorical and numeric covariates to illustrate how 
regression and analysis of (co-)variance can be combined. I like to use 
MASS's whiteside data for this:

data("whiteside", package = "MASS")
m1 <- lm(Gas ~ Temp, data = whiteside)
m2 <- lm(Gas ~ Insul + Temp, data = whiteside)
m3 <- lm(Gas ~ Insul * Temp, data = whiteside)
anova(m1, m2, m3)

Moreover, some binary response data.frame with a few covariates might be a 
useful addition to "datasets". For example a more granular version of the 
"Titanic" data (in addition to the 4-way tabel ?Titanic). Or another 
relatively straightforward data set, popular in econometrics and social 
sciences is the "Mroz" data, see e.g., help("PSID1976", package = "AER").

I would be happy to help with these if such additions were considered for 
datasets/stats.
On Sat, 15 Dec 2018, David Hugh-Jones wrote: