set.seed(123) ## Non-linear mean with constant SD logx <- seq(0.001,1, length.out = 1000) noise <- rnorm(1000) y <- logx + noise/4 x <- 10^logx par(mfrow = c(2,2)) plot(x, y, xlab = "x", ylab = "y", col = "grey") lines(x, logx) ## => transform the covariate plot(logx, y, xlab = expression(paste(log[10], "(x)")), ylab = "y", col = "grey") lines(logx, logx) ## Non-linear mean and non-constant SD set.seed(124) x <- seq(1.002, 3, length.out = 1000) noise <- rnorm(1000) logy <- -(x + noise/9) y <- 10^logy plot(x, y, xlab = "x", ylab = "y", col = "grey") lines(x, 10^-x) ## => transform the outcome plot(x, logy, xlab = "x", ylab = expression(paste(log[10], "(y)")), col = "grey") lines(x, -x)