Your verification ID is: guDlT7MCuIOFFHSbB3jPFN5QLaQ Big Computing: Using the Pairs Plot Function in Base R

Friday, October 10, 2014

Using the Pairs Plot Function in Base R

The pairs plot is used to compare all the data in the selected range with all the other columns on a one to one basis. It is a great first pass to see if a relationship between two variables jumps out at you. In order to show this I will create four variable. The first is a random uniform. The second variable depends on the first variable in a linear relationship. The third variable has a squared relationship with the first variable. Finally the fourth variable has a cubic relationship with the first variable.
indep<-runif(300,-25,25)
linear<-2*indep+rnorm(300,0,3)
exp2<-.05*indep^2+rnorm(300,0,2)
exp3<-indep^3/1000+rnorm(300,0,1)
samples<-as.data.frame(cbind(indep,linear,exp2,exp3))
Now plot them using pairs and see what it produces
pairs(~indep+linear+exp2+exp3,data=samples)