/* * * This is the SAS file for Homework #2 for * 90-771 for Spring, 2005 * * */ options linesize=80; options pagesize=60; filename mepsraw 'MEPSextract1996.txt'; data MEPS; infile mepsraw; input age sex income employed insured health spending; proc contents; proc means; proc corr; proc freq; table insured; table insured*employed; data MEPS; set MEPS; incomeK = income/1000; drop income; proc means; proc reg; model insured = age sex employed incomeK / ACOV; output out=ols_pred pred=Yhat; title "Linear probability model"; data ols_pred; set ols_pred; label Yhat=' '; Yhat01 = (Yhat>1 OR Yhat<0); proc means data=ols_pred; title "LPM predicted probabilities"; proc logistic descending data=MEPS; model insured = age sex employed incomeK; output out=logit_out prob=Phat Xbeta=Ystarhat; title "Logit model"; data logit_out; set logit_out; label Ystarhat=' '; label Phat=' '; drop _LEVEL_; proc logistic descending data=MEPS; model insured = age sex employed incomeK / link=probit; output out=probit_out prob=Phat Xbeta=Ystarhat; title "Probit model"; data probit_out; set probit_out; label Ystarhat=' '; label Phat=' '; drop _LEVEL_; data logit_out; set logit_out; me_incK = Phat*(1-Phat)*(0.0451); proc means; var Phat me_incK; title "Logit marginal effects"; data probit_out; set probit_out; me_incK = pdf('NORMAL',Ystarhat,0,1)*(0.0204); proc means; var Phat me_incK; title "Probit marginal effects"; proc logistic descending data=MEPS; model insured = employed incomeK / link=probit; output out=logit_out prob=Phat Xbeta=Ystarhat; title "Probit model --- testing joint hypothesis";