Book Image

Haskell Data Analysis Cookbook

By : Nishant Shukla
Book Image

Haskell Data Analysis Cookbook

By: Nishant Shukla

Overview of this book

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

Obtaining the covariance matrix from samples


A covariance matrix is a symmetric square matrix whose elements in row i and column j correspond to how related they are. More specifically, each element is the covariance of the variables represented by its row and column. Variables that move together in the same direction have a positive covariance, and variables with the opposite behavior have a negative covariance.

Let's assume we are given four sets of data of three variables as shown in the following table:

Notice how Feature 1 and Feature 3 appear to be similar in their patterns, yet Feature 1 and Feature 2 appear to be uncorrelated. Similarly, Feature 2 and Feature 3 are significantly correlated.

The covariance matrix will be a 3 x 3 symmetric matrix with the following elements:

Getting ready

Install the hstats library using cabal as follows:

$ cabal install hstats

Alternatively, install the package by performing the following steps:

  1. Download the source code of the package from http://hackage...