Book Image

Clojure Data Analysis Cookbook - Second Edition

By : Eric Richard Rochester
Book Image

Clojure Data Analysis Cookbook - Second Edition

By: Eric Richard Rochester

Overview of this book

Table of Contents (19 chapters)
Clojure Data Analysis Cookbook Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Scaling variables to simplify variable relationships


We don't always work with numbers as they are. For example, population is often given in thousands. In this recipe, we'll scale some values to make them easier to work with. In fact, some algorithms work better with scaled data. For instance, linear regression models are sometimes able to fit the data better after the data has been scaled logarithmically.

Getting ready

We'll use these dependencies in our project.clj file:

(defproject statim "0.1.0"
  :dependencies [[org.clojure/clojure "1.6.0"]
                 [incanter "1.5.5"]])

And we'll use these namespaces in our script or REPL:

(require '[incanter.core :as i]
         'incanter.io)

For data, we'll use the Chinese development data from World Bank, which we originally saw in the Selecting columns with $ recipe from Chapter 6, Working with Incanter Datasets. I've pulled out the data related to agricultural land use and rearranged the columns. You can download this from http://www.ericrochester...