Collinearity

We might try at this point to keep adding features to our model in an attempt to increase its explanatory power.

For example, we also have a "Date of birth" column and we may be tempted to try and include this too. It is a date, but we could easily convert it into a number suitable for use in regression. We could do this simply by extracting the year from their birth date using the clj-time library:

(defn to-year [str] (-> (coerce/from-date str) (time/year))) (defn ex-3-27 [] (let [data (->> (swimmer-data) (i/add-derived-column "Dummy MF" ["Sex"] dummy-mf) (i/add-derived-column "Year of birth" ["Date of birth"] to-year)) x (->> data (feature-matrix ["Height, cm" "Age" "Dummy MF" "Year of birth"]) (add-bias)) y (->> (i/$ "Weight" data) ...

Get Clojure for Data Science now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.