wage education experience exp2
Min. : 1.000 Min. : 2.00 Min. : 0.00 Min. : 0.0
1st Qu.: 5.250 1st Qu.:12.00 1st Qu.: 8.00 1st Qu.: 64.0
Median : 7.780 Median :12.00 Median :15.00 Median : 225.0
Mean : 9.024 Mean :13.02 Mean :17.82 Mean : 470.6
3rd Qu.:11.250 3rd Qu.:15.00 3rd Qu.:26.00 3rd Qu.: 676.0
Max. :44.500 Max. :18.00 Max. :55.00 Max. :3025.0
Data Description
I use the CPS1985 dataset from the AER package. This is cross-sectional economic data based on a sample of workers from the 1985 Current Population Survey. The dependent variable is wage, measured in dollars per hour. The explanatory variables are education (years of schooling), experience (potential work experience), and exp2 (experience squared). This specification allows wages to vary linearly with education and nonlinearly with experience.
These numbers are just the coefficients from the regression using matrix algebra. The first is the intercept, and the rest are for education, experience, and experience squared. For example, the education coefficient (~0.88) means each extra year of school is linked to about $0.88 more per hour. The negative experience² term shows diminishing returns, so wages grow with experience but slow down over time.
To get the standard errors by hand, we first look at the residuals (the errors between actual and predicted values). Bigger residuals mean more noise in the model. We use those to estimate the error variance, then combine it with (X’-X)^-1 to get the variance of each coefficient. Taking the square root gives the standard errors.
Intuitively, standard errors show how confident we are in each coefficient—more noise = bigger standard errors, cleaner data = smaller ones.
The standard errors I calculated by hand match the ones from lm(), which shows that both methods are using the same underlying formula. In both cases, we first measure how much error is left in the model (using the residuals), and then adjust that based on the structure of the data (X’-X)^-1. The reason they match is because lm() is internally doing the exact same matrix algebra calculations, just automatically. This confirms that the standard errors come from the same logic as the coefficient estimates, just adding a measure of uncertainty.