x <- runif(100, 0, 1)

f <- function(a, b) function(x) a * x + b

y <- f(2.5, 1.3)(x)
y <- f(2.5, 1.3)(x) + rnorm(length(x), sd=0.2)

m <- lm(y ~ x)
plot(m)

plot(x, y, pch=20)
abline(m)
segments(
	x,
	predict(m),
	x,
	y
)
