Linear Models

Regression and analysis of variance (anova or ANOVA) are the basic work horses of statistical inference. Regression measures how response changes with predictor along a straight line. Anova is used to compare means for two or more groups. Regression and anova are often lumped together as aspects of linear models. In fact, analysis of covariance (ancova or ANCOVA) is a simple way to have separate (possibly parallel–same slope) regression lines for each group.

aov() & lm() commands both fit linear models, with aov focused on comparing “factors” (categorical predictors) and lm focused on “regressors” (continuous predictors). Actually, lm can be used for both, but be careful how you set up factors. The anova() and drop1() commands are used to get tabular summaries of fits with aov or lm. anova gives sequential (Type I) tests, while drop1 gives adjusted (Type III) tests.

Several useful packages have been developed for linear models:

Regression with more than one predictor gets complicated, and there is no one best way to proceed. However, there are guidelines and useful tools.

Models that are not linear

There are two types of models that are not linear. One involves models with non-normal errors, such as arises with counts. Counts might be of yes/no (binomial and logistic) situations or counts of some event (Poisson). There are more general approaches, hence the complicated name of generalized linear models. Underlying these models is a linear relationship. For instance, Poisson counts assume the log of the mean depends linearly on predictors, while binomial counts assume the logit of the proportion (logit(p) = log(p)/log(1-p)) depends linearly on predictors.

The other type are models in which predictors have a non-linear relation with response, such as y ~ x/(1+w).

Mixed models

Some models mix so-called fixed and random effects. Fixed are as above. Random effects account for the fact that the observed levels of components of a model might be uncertain or be sampled from some broader class of possible levels. Sometimes these random components are interpreted as having a distribution of interest, hence Bayesian.


This site uses Just the Docs, a documentation theme for Jekyll.