# generate correlated data
d = data.frame(mvrnorm(1000, mu=c(0,0), Sigma=matrix(c(1,.6,.6,1), nrow=2)))
names(d) = c("x","y")
## Skew Y
d$y = d$y^2
scaleBreak(d$x, d$y, breakpos=4, plot.numbers=1)
## add a lowess line
lines(lowess(d$x, d$y), col="red")
## add a fitted line
mod = glm(y~x, data=d, family=inverse.gaussian)
curve(predict(mod,data.frame(x=x),type="resp"),add=TRUE,col="blue")
## add second plot
scaleBreak(d$x, d$y, breakpos=4, plot.numbers=2)
Run the code above in your browser using DataLab