* Use GPA1.dta
generate parcollsum = fathcoll + mothcoll
generate parcoll = (parcollsum > 0)
* OLS standard errors for LPM
regress PC hsGPA ACT parcoll
predict yhat
* Checking to see if any of the yhat are outside of the interval (0,1)
* None of them are so we do not need to make any adjustments in
* calculating the WLS weights
summarize yhat
generate vary = yhat*(1 - yhat)
generate weight = 1/sqrt(vary)
* Heteroskedasticity-robust standard errors for LPM
regress PC hsGPA ACT parcoll, vce(robust)
* Using WLS to estimate the LPM
generate PCstar = PC*weight
generate onestar = 1*weight
generate hsGPAstar = hsGPA*weight
generate ACTstar = ACT*weight
generate parcollstar = parcoll*weight
regress PCstar onestar hsGPAstar ACTstar parcollstar, noconstant
* There is very little difference in the OLS and WLS results in this case