This week (Wed 29th Oct. 2019) will be the second of eight months of R Open Data Labs (one per month at the last Wednesday of each month).
Each of these labs will start with a very short (~15 minute) review of available R programming environments for those who are entirely new to R.
The next part of the session will be a brief sightseeing tour of a particular R package + technique, for those who are looking for a better understanding of what R can do (~ 0.5 hrs).
The sightseeing portion of the October 29th R lab will focus on R’s unique and efficient way of representing statistical models.
As the relevant wikipedia page says, a statistical model “is usually specified as a mathematical relationship between one or more random variables and other non-random variables. As such, a statistical model is ‘a formal representation of a theory.’ ”
R has a special ‘formula’ object (going back to S, the precursor to R) that provides a sort of short hand, or regular expression syntax for easily describing statistical models.
Some basics:
Some extra details:
- This article has a more technical discussion of the formula object, in the context of a library built to extend this original object (class).
Some examples of using the formula object:
- The lm function in R
- Linear Regression Example in R using lm() Function
- Understanding the output of the lm function.
- A slide deck discussing statistical models in S, but still relevant in R.
Last but not least: a bit on objects (or classes in R):