In Chapter 2, Basic Concepts – Simple Linear Regression, we learned to use the lm() function to create a simple linear regression model. We can also use it to solve this kind of problem.
To practice this method, we can draw on the many datasets available on the internet. In this case, we will load a .csv file named EscapingHydrocarbons.csv into the R environment; it contains the quantity of hydrocarbons escaping, depending on different variables.
Source: Linear Regression Datasets offered by the Department of Scientific Computing, Florida State University (http://people.sc.fsu.edu/~jburkardt/datasets/regression/regression.html).
When petrol is pumped into tanks, hydrocarbons escape. To evaluate the effectiveness of pollution controls, experiments were performed. The quantity of hydrocarbons escaping was measured...