# R code to study the correlation # between LotSize and WorkHrs for the Toluca data set # Save the data file into a directory and # use the full path name: toluca.data <- read.table(file = "z:/My Documents/teaching/stat_704/tolucadata.txt", header=FALSE, col.names = c('lotsize', 'workhrs')) # attaching the data frame: attach(toluca.data) # finding the correlation coefficient between workhrs and lotsize: cor(workhrs, lotsize) # finding a 95% CI for rho using Fisher's z-transformation: cor.test(workhrs, lotsize, method="pearson", conf.level=0.95) # Example of nonparametric alternative: # finding the Spearman rank correlation coefficient between workhrs and lotsize: cor(workhrs, lotsize, method="spearman")