age_grid = seq(from = min(datos$age), to = max(datos$age), by = 1)
alfa = 0.05
yp1 = predict(m1, newdata = data.frame(age = age_grid), se = T)
yp2 = predict(m2, newdata = data.frame(age = age_grid), se = T)
yp11 = yp1$fit + qnorm(alfa/2)*yp1$se.fit
yp12 = yp1$fit + qnorm(1-alfa/2)*yp1$se.fit
plot(datos$age,datos$wage, cex = 0.5, col = "darkgrey", ylab = "wage (x 1000 $)", xlab = "age")
#
lines(age_grid, yp1$fit, col = "blue", lwd = 2)
lines(age_grid, yp11, col = "blue", lty = 3)
lines(age_grid, yp12, col = "blue", lty = 3)
#
lines(age_grid, yp2$fit, col = "red", lwd = 2)
#
legend(60,200, legend = c("s = 0.2", "s = 0.5"), col = c("blue","red"), lty = 1, lwd = 2)