Stochastic Nonsense

Put something smart here.

Comparing Many Variables in R With Plots -- Part 3 in a Series

This is post #03 in a running series about plotting in R.

Say you have a data frame with a number of variables that you would like to compare against each other. While you could plot them all on the same graph, statisticians frequently wish to look for visual evidence of correlation between different sets of observations — particularly when looking for visual evidence of heteroskedasticity. A simple way to do this for every variable in a data frame is to call plot on the data frame itself.

Say we have data as such:

s <- data.frame(x=1:30, y=10*runif(n=30))
s$z <- 10*runif(n=30)
# (a more common application is calling residual or predict on a fitted model)

This is an example of a pairs plot, which I’ll cover in more detail in the future.