Tuesday, June 19, 2012

Head First Data Analysis - Regression: Prediction using Clojure

I’ve been reading the excellent book from the Head First Series: Head First Data Analysis. The chapter on regression contains a problem been solved in the book using R. I have translated the solution to clojure using Incanter.

The problem is pretty simple. We have a dataset that contains information about the raises given to employees, the raise requested, if they negotiated the raise, the gender and the year. People want to know what to ask for. And they want to know what they’ll get, given what they’ve asked for. And the regression line predicts what raises people will receive.

Here is the plot with the data points, each data point is a person that negotiated their salary. In the X-axis is how much they requested for a raised and in the Y-axis how much they received. And in Blue is the Regression Line.

Here is the code:

No comments:

Post a Comment