## Linear Regression with R

I wrote an article titled “Linear Regression with R” in the January 2016 issue of Visual Studio Magazine. See https://visualstudiomagazine.com/articles/2016/01/01/linear-regression-with-r.aspx.

R is an old (I think dating back to the 1980s and perhaps earlier) scripting language and execution environment used for statistical data analyses. Linear regression is perhaps the most fundamental technique of classical statistics. In my article I demonstrate how to perform LR on some fake data to predict a person’s annual income from their age, political leaning (conservative, moderate, liberal), and years of education.

The result is an equation:

```I = -74.9 + (0.09 * age) +
(-33.11 * isLiberal) +
(-18.22 * isModerate) +
(10.00 * education)
```

So, for a person who is 30 years old, is a moderate politically, and who has 16 years of education, the predicted income is:

```I = -74.9 + (0.09 * 30) +
(-33.11 * 0) +
(-18.22 * 1) +
(10.00 * 16)

= -74.9 + 2.7 + 0 + -18.22 + 160.0
= 69.58 (\$69,580.00 per year)
```

R is a strange language and in my article I explain R from the viewpoint of a software developer rather than from the viewpoint of a college statistics student.