Understanding linear regression
There are several reasons why linear regression continues to be useful and powerful for data analytics:
- Linear regression tends to work well on a wide variety of datasets
- Linear regression can address many business intelligence problems
- Linear regression provides a solid foundation on which you can learn more advanced and sophisticated prediction modeling techniques
In a business context, analysts use linear regression in diverse endeavors such as evaluating trends, making revenue estimates, analyzing the impact of price or supply changes, and assessing risk. You will start this journey by building a linear model.
The lm() function
The principal tool used for linear regression in R is the lm()
function. Refer to its help page by typing ?lm
into your console. You will see the function has 13 arguments. For the most part, you will be using just two arguments, formula
and data
.
When you run a linear regression using lm()
, R returns an object of the lm
class. This...