Commit cf8d26b3 authored by Vallo Varik's avatar Vallo Varik
Browse files

Explain connection between lm and ggplot2

parent 8f540daf
......@@ -34,7 +34,7 @@ The result is a familiar loess function from MS Excel. The trend, however, seems
p1 + geom_smooth(method = 'lm')
```
What if we would like to know the equation for such a linear model? To do that, we use `lm` (stands for linear model) function:
What if we would like to know the equation for such a linear model? To do that, we use `lm` (stands for linear model) function (which `ggplot`, in fact, uses in the background anyways):
```{r}
mod = lm(dist ~ speed, data = cars)
......
......@@ -32,7 +32,8 @@ suffice. To do that with `ggplot2`, issue `method = 'lm'` to
![](formulaR_files/figure-markdown_strict/unnamed-chunk-3-1.png)
What if we would like to know the equation for such a linear model? To
do that, we use `lm` (stands for linear model) function:
do that, we use `lm` (stands for linear model) function (which `ggplot`,
in fact, uses in the background anyways):
mod = lm(dist ~ speed, data = cars)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment