Data from 35 Category 5 Hurricanes showing the relationship between wind speed (X) and pressure (Y). The blue and green lines represent the means of the X and Y values, respectively. The Quadrants have been labeled. The points have been jittered to reduce overlap of observations.
English: This is an illustration for part of an example for calculating the Quadrant Count Ratio (QCR), a measure of association that is valuable teaching tool as a precursor to Pearson's correlation coefficient. R code is given below. qcr <- function(dat){ # This function has been modified specifically for making this plot! n <- nrow(dat); m.x <- mean(dat[,1]); m.y <- mean(dat[,2]);print(m.x);print(m.y); # in QCR we ignore points that are on the mean lines # number of points in Quadrants 1 and 3 q13 <- sum(dat[,1] > mean(dat[,1]) & dat[,2] > mean(dat[,2]))+sum(dat[,1] < mean(dat[,1]) & dat[,2] < mean(dat[,2])) # number of points in Quadrants 2 and 4 q24 <- sum(dat[,1] < mean(dat[,1]) & dat[,2] > mean(dat[,2]))+sum(dat[,1] < mean(dat[,1]) & dat[,2] > mean(dat[,2])) print("Q1"); print(sum(dat[,1] > mean(dat[,1]) & dat[,2] > mean(dat[,2]))); print("Q2"); print(sum(dat[,1] < mean(dat[,1]) & dat[,2] > mean(dat[,2]))); print("Q3"); print(sum(dat[,1] < mean(dat[,1]) & dat[,2] < mean(dat[,2]))); print("Q4"); print(sum(dat[,1] > mean(dat[,1]) & dat[,2] < mean(dat[,2]))); return((q13-q24)/n); } #hurricanes <- read.table(file="clipboard",header=TRUE); hurricanes <- structure(list(storm = structure(c(35L, 22L, 29L, 33L, 1L, 28L, 6L, 30L, 13L, 9L, 26L, 27L, 10L, 25L, 24L, 23L, 2L, 5L, 12L, 3L, 20L, 32L, 34L, 21L, 18L, 11L, 4L, 7L, 15L, 31L, 17L, 14L, 8L, 16L, 19L), .Label = c("Allen", "Andrew", "Anita", "Bahamas", "Beulah", "Camille", "Carla", "Cleo", "Cuba24", "Cuba32", "CubaBrownsville", "David", "Dean", "Dog", "Donna", "Easy", "Edith", "Emily", "Ethel", "Felix", "FortLauderdale", "Gilbert", "Hattie", "Hugo", "Isabel", "Ivan", "Janet", "Katrina", "LaborDay", "Mitch", "NewEngland", "Okeechobee", "Rita", "Tampico", "Wilma"), class = "factor"), season = c(2005L, 1988L, 1935L, 2005L, 1980L, 2005L, 1969L, 1998L, 2007L, 1924L, 2004L, 1955L, 1932L, 2003L, 1989L, 1961L, 1992L, 1967L, 1979L, 1977L, 2007L, 1928L, 1933L, 1947L, 2005L, 1933L, 1932L, 1961L, 1960L, 1938L, 1971L, 1950L, 1958L, 1951L, 1960L), cat5.time = c(18L, 24L, 18L, 24L, 72L, 18L, 18L, 42L, 24L, 12L, 60L, 18L, 78L, 42L, 6L, 18L, 16L, 18L, 42L, 12L, 24L, 12L, 12L, 30L, 6L, 12L, 24L, 18L, 12L, 18L, 6L, 60L, 6L, 18L, 6L), max.wind.mph = c(185L, 185L, 185L, 180L, 190L, 175L, 190L, 180L, 175L, 165L, 165L, 175L, 175L, 165L, 160L, 160L, 175L, 160L, 175L, 175L, 175L, 160L, 160L, 160L, 160L, 160L, 160L, 175L, 160L, 160L, 160L, 185L, 160L, 160L, 160L), pressure.hPa = c(882L, 888L, 892L, 895L, 899L, 902L, 905L, 905L, 905L, 910L, 910L, 914L, 915L, 915L, 918L, 920L, 922L, 923L, 924L, 926L, 929L, 929L, 929L, 929L, 929L, 930L, 931L, 932L, 932L, 938L, 943L, 948L, 948L, 957L, 972L)), .Names = c("storm", "season", "cat5.time", "max.wind.mph", "pressure.hPa"), class = "data.frame", row.names = c(NA, -35L)); qcr(hurricanes[,4:5]); set.seed(6); # for jitter plot.qcr <- function(dat){ # This function has been modified specifically for making this plot! value <- qcr(dat); plot(x=jitter(dat[,1],factor=0.2),y=jitter(dat[,2],factor=0.3), pch=21,cex=2,bg="yellow",col="red",cex.lab=1.2,cex.main=1.5, xlab="Maximum Wind Speed (mph)", ylab="Minimum Recorded Pressure (hPa)", main="Wind Speed and Pressure for Category 5 Hurricanes (1924-2007)"); abline(v=mean(dat[,1]),col="blue",lwd=2); # adds a line for x mean abline(h=mean(dat[,2]),col="green",lwd=2); # adds a line for y mean } plot.qcr(hurricanes[,4:5]); text(x=177.5,y=960,"Quadrant I",cex=2.5); text(x=165,y=960,"Quadrant II",cex=2.5); text(x=165,y=885,"Quadrant III",cex=2.5); text(x=177.5,y=885,"Quadrant IV",cex=2.5);