Document (1)
Document (1)
set.seed(42)
)
model <- lm(income ~ education_years, data = data)
summary(model)
plot(data$education_years, data$income,
xlab = "Years of Education",
ylab = "Income ($)",
main = "Income vs. Education Years",
pch = 19,
col = "blue",
alpha = 0.5)
abline(model, col = "red", lwd = 2)
Residuals:
Min 1Q Median 3Q Max
-18884.2 -5066.4 122.5 5410.6 28624.0
Coefficients:
Estimate Std. Error t value
Pr(>|t|)
(Intercept) 17667.8 4790.9 3.688
0.000371 ***
education_years 5090.5 292.2 17.420 <
2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05
‘.’ 0.1 ‘ ’ 1