Well what do you want to do:
# sample data x <- rnorm(50,0,2) y <- x+rnorm(50,0,2) # construct polygons div <- quantile(yx,c(0.25,0.75)) x1 <- min(c(x,y)) x2 <- max(c(x,y)) plot(x,y,type="n") polygon(x=c(x1,x1,x2,x2),y=c(x1+div,(x2+div)[c(2,1)]),col="grey") abline(0,1) points(x,y)
What I would do is:
qplot(x,y,geom="point") + stat_smooth(method="lm")
The standard deviation you want to calculate is
sd(yx)
The correct measure you're probably looking for is:
sd(residuals(lm(y~x)))
You must think in terms of a linear model of y by x in order to get any meaningful result if you have no very good reason not to. If the ratio between x and y is not 1 on 1, then on condition that the correct model does not make sense like that. And if the ratio of x to y is not 1 to 1, yx will not be normally distributed and, therefore, sd will be difficult to interpret in a meaningful way.
source share