Skip to content

Instantly share code, notes, and snippets.

@mojaveazure
Created December 18, 2015 22:44
Show Gist options
  • Save mojaveazure/f1843adcecdaf45086ac to your computer and use it in GitHub Desktop.
Save mojaveazure/f1843adcecdaf45086ac to your computer and use it in GitHub Desktop.
Some stuff about formulas in R

R Formula Specifications

Adapted from the National Park Service


Right-Side

Right Side Meaning
A + B Main effects of A and B
A:B Interaction of A with B
A * B Main effects and interactions: A + B + A:B
A * B * C Main effects and interactions of A, B, and C: A + B + C + A:B + A:C + B:C + A:B:C
(A + B + C)^2 A, B, and C crossed to level 2: A + B + C + A:B + A:C + B:C
A * B * C - A:B:C Main effects plus two-way interactions
1 + state + state:county Nested ANOVA
1 + state + county%in%state nested NOVA emphasizing county nested in state
state / county Nested ANOVA
(1 / subject) Fit random intercepts for subjects
(1 + time / subject) Fir both random intercepts and random subject-specific slopes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment