I've checked for an answer to my problem, and the closest I could find was here: Why does plot behave differently for same but scaled data?. I understand atomic objects and already convert to a data frame.
I've loaded some chemical Reaction data:
library(car)
theURL <- "http://lib.stat.cmu.edu/datasets/Andrews/T30.1"
theNames <- c("Table", "Number", "Row", "Experiment", "Temperature",
"Concentration", "Time", "Unchanged", "Converted", "Unwanted")
Reaction <- read.table(theURL, header = F , col.names = theNames)
Reaction <- Reaction[-c(1:4)]
I then draw a scatterplot; solid lines through the mean of X and the mean of Y; dotted lines at means ± 2SDs. Also a segment of slope Sy/Sx drawn at ± 5SDs because I couldn't get abline()
to draw it.
scatterplot(Reaction$Temperature, Reaction$Converted, smooth = FALSE,
regLine = FALSE, grid = FALSE, xlim = c(150, 185), xlab = "Temperature", ylab = "% Converted", main = "Reaction Results", ylim = c(45, 70))
TempMean = mean(Reaction$Temperature)
ConvMean = mean(Reaction$Converted)
TempSD = sd(Reaction$Temperature)
ConvSD = sd(Reaction$Converted)
abline(col = c("red", "green"), v = TempMean, h = ConvMean)
abline(col = "green", lty = "dotted", v = (c(TempMean - 2*TempSD, TempMean + 2*TempSD)))
abline(col = "red", lty = 3, h = (c(ConvMean - 2*ConvSD, ConvMean + 2*ConvSD)))
segments(TempMean - 5*TempSD, ConvMean - 5*ConvSD, TempMean + 5*TempSD, ConvMean + 5*ConvSD)
...and now the big reveal. If I scale everything, the scatterplot essentially does the same thing.
# Scale Reaction Data
Reaction.scaled <- as.data.frame(scale(Reaction))
# Mean and sd Lines
scatterplot(Reaction.scaled$Temperature, Reaction.scaled$Converted, smooth = FALSE, regLine = FALSE, grid = FALSE, xlab = "Temperature", ylab = "% Converted", main = "Reaction Results")
TempMean = mean(Reaction.scaled$Temperature)
ConvMean = mean(Reaction.scaled$Converted)
TempSD = sd(Reaction.scaled$Temperature)
ConvSD = sd(Reaction.scaled$Converted)
abline(col = c("red", "green"), v = TempMean, h = ConvMean)
abline(col = "green", lty = "dotted", v = (c(TempMean - 2*TempSD, TempMean + 2*TempSD)))
abline(col = "red", lty = 3, h = (c(ConvMean - 2*ConvSD, ConvMean + 2*ConvSD)))
segments(TempMean - 5*TempSD, ConvMean - 5*ConvSD, TempMean + 5*TempSD, ConvMean + 5*ConvSD)
...but the drawing doesn't show the scaled mean at (0,0). I suspect this is something to do with high-level vs low-level graphics functions.