O'Reilly logo

R for Data Science by Dan Toomey

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 5. Data Analysis – Correlation

Correlation is a good technique to use on your dataset. Correlation helps us to establish basic relationships between data items.

In this chapter, we look at tools available in R for correlation:

  • A basic correlation
  • Visualizing correlations
  • Covariance
  • Pearson correlation
  • Polychoric correlation
  • Tetrachoric correlation
  • A heterogeneous correlation matrix
  • Partial correlation

Packages

In R, there are several packages that provide the correlation functionality to the programmer. We will be using the following packages in this chapter:

  • corrgram: This is the tool to graphically display correlations
  • Hmisc: This contains a variety of miscellaneous R functions
  • polycor: This contains functions to compute polychoric correlations
  • ggm ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required