clear all
set more off
use C:\Data\probit_insurance
* Using Global statements to reduce the burden of continually entering
* target and independent variables in STATA command statements
global ylist ins
global xlist retire age hstatusg hhincome educyear married hisp
describe $ylist $xlist
summarize $ylist $xlist
tabulate $ylist
* Linear Probability Model with Robust Standard Errors
reg $ylist $xlist, vce(robust)
* Calculate Marginal Effects at Means and the Average Marginal Effects
* Notice that coefficient by coefficient the LS coefficients exactly
* match the marginal effects measured at the means and the average of
* the marginal effects as in the Average marginal probability effects
* (AMPEs) as calculated in equation (4.10) in the W&B textbook.
quietly reg $ylist $xlist
margins, dydx(*) atmeans
margins, dydx(*)
* Properties of marginal effects in both Probit and Logit Models:
* (1) The sign of the marginal effect is the same as the sign of
* the coefficient
* (2) The marginal effect is largest at x(transpose)*beta = 0
* (3) The marginal effect varies by individual
* Probit model
probit $ylist $xlist
* Calculate Marginal Effects
quietly probit $ylist $xlist
margins, dydx(*) atmeans
margins, dydx(*)
* Plot the Receiver Operating Characteristic (ROC) Curve
lroc $ylist
* Report the Classification Table Results for the Probit Model
* using a cutoff probability of 0.3871 which is the proportion
* of people in the sample that have insurance
estat classification , cutoff(0.3871)
* Plot the Sensitivity and Specificity of the Probit Model
* as a function of the cut-off probability
lsens $ylist
* One of the nice things about the Logit model is that
* not only can the coeficients be reported but if one uses
* the "or" option the Odd ratio estimates for each coefficient
* can be reported. For example, if the odds ratio = exp(b)
* of a coefficient is 0.5, then for a one unit increase in
* the associated variable, the odds ratio (= p/(1-p)) goes
* down by 50%. If the odds ratio is 1.0 then a one unit
* increase in the associated variable does not change the odds
* ratio. If the odds ratio is 1.5 then a one unit increase
* in the associated variable increase the odds ratio by 50%
* Notice that if the odds ratio is significantly different from
* then the corresponding logit coefficient will be significantly
* different from zero
* Logit model
logit $ylist $xlist
* Reporting the odds ratio using the "or" option in the logit command
logit $ylist $xlist, or
* Plot the Receiver Operating Characteristic (ROC) Curve
lroc $ylist
* Report the Classification Table Results for the Logit Model
* using a cutoff probability of 0.3871 which is the proportion
* of people in the sample that have insurance
estat classification , cutoff(0.3871)
* Plot the Sensitivity and Specificity of the Probit Model
* as a function of the cut-off probability
lsens $ylist
********************************************************
* Now to calculate Predicted Probabilities
quietly logit $ylist $xlist
predict plogit, pr
quietly probit $ylist $xlist
predict pprobit, pr
quietly regress $ylist $xlist
predict pols, xb
* Now we summarize the predicted probabilities
* of the three different methods: Probit, Logit, and LPM
summarize $ylist plogit pprobit pols