?********************************** ? Tutorial for Microeconometrics ? Summer term 2008 ? Problem Set 2: Probit und Tobit ? Katrin Sommerfeld ?********************************** options crt; freq N; read (file='L:\Microeconometrics\motherswork.raw') ifwork hours manearn married kids ; msd(terse) @all; stop; ?********************************** title 'Exercise 1: Probit'; ?********************************** ? Exercise 1a probit ifwork c manearn married kids ; ?stop; ?************************************* title 'Marginal effects at mean'; ?************************************* title '1b) Marginal effect of continuous variable at mean: manearn'; msd(terse) manearn; set pr_mean=norm(@coef(1)+@mean*@coef(2)+1*@coef(3)+2*@coef(4)); set manearn_mean=pr_mean*@coef(2); print pr_mean manearn_mean; ?stop; ?************************************* title '1c) Marginal effect of dummy variable at mean: married'; set pr_mean_mar=cnorm(@coef(1)+@mean*@coef(2)+1*@coef(3)+2*@coef(4)); set pr_mean_notmar=cnorm(@coef(1)+@mean*@coef(2)+0*@coef(3)+2*@coef(4)); set married_mean=pr_mean_mar-pr_mean_notmar; print pr_mean_mar pr_mean_notmar married_mean; ?stop; ?************************************ title 'Average marginal effects'; ?************************************ title '1d) Average marginal effect of continuous variable: manearn'; genr predict=@coef(1)+manearn*@coef(2)+married*@coef(3)+kids*@coef(4); genr ame_pr=norm(predict); genr ame_manearn=@coef(2)*ame_pr; msd(terse) ame_pr ame_manearn; ?stop; ?************************************ title '1e) Average marginal effect of dummy variable: married'; genr predict_mar=@coef(1)+manearn*@coef(2)+1*@coef(3)+kids*@coef(4); genr predict_notmar=@coef(1)+manearn*@coef(2)+0*@coef(3)+kids*@coef(4); genr ame_mar=cnorm(predict_mar); genr ame_notmar=cnorm(predict_notmar); genr ame_married=ame_mar-ame_notmar; msd(terse) ame_mar ame_notmar ame_married; ?stop; ?************************************* title 'Additional exercise: discrete variable'; ?************************************* title '1f) Marginal effect of discrete variable at mean: kids'; msd(terse) manearn; set pr_mean_1kid=cnorm(@coef(1)+@mean*@coef(2)+1*@coef(3)+1*@coef(4)); set pr_mean_2kid=cnorm(@coef(1)+@mean*@coef(2)+1*@coef(3)+2*@coef(4)); set pr_mean_3kid=cnorm(@coef(1)+@mean*@coef(2)+1*@coef(3)+3*@coef(4)); set second_mean=pr_mean_2kid-pr_mean_1kid; set third_mean=pr_mean_3kid-pr_mean_2kid; print pr_mean_1kid pr_mean_2kid pr_mean_3kid second_mean third_mean; ?stop; ?************************************* title '1f) Average marginal effect of discrete variable: kids'; genr predict_1kid=@coef(1)+manearn*@coef(2)+married*@coef(3)+1*@coef(4); genr predict_2kid=@coef(1)+manearn*@coef(2)+married*@coef(3)+2*@coef(4); genr predict_3kid=@coef(1)+manearn*@coef(2)+married*@coef(3)+3*@coef(4); genr ame_1kid=cnorm(predict_1kid); genr ame_2kid=cnorm(predict_2kid); genr ame_3kid=cnorm(predict_3kid); genr ame_2nd=ame_2kid-ame_1kid; genr ame_3rd=ame_3kid-ame_2kid; msd(terse) ame_1kid ame_2kid ame_3kid ame_2nd ame_3rd; ?stop; ?************************************** title 'Exercise 2: Tobit'; ?************************************** hist (discrete) hours; ?stop; ?olsq hours c manearn married kids; title '2a) Tobit Regression'; tobit hours c manearn married kids; set sigma=@coef(5); ? stop ?************************************** ? Marginal Effects ?************************************** ? 2c) Marginal effects on actual variable title '2c) Average marginal effect on actual variable'; genr xb=@coef(1)+manearn*@coef(2)+married*@coef(3)+kids*@coef(4); genr pr_work=cnorm(xb/sigma); genr ame_t=@coef(2)*pr_work; msd(terse) ame_t; ?stop title '2c) Marginal effect on actual variable at the mean'; msd(terse) manearn; set xb_mean=@coef(1)+@mean*@coef(2)+1*@coef(3)+2*@coef(4); set pr_work_mean=cnorm(xb_mean/sigma); set met_mean=@coef(2)*pr_work_mean; print met_mean; ?stop; ? 2d) Marginal effects on positive observations title '2d) Average marginal effect on positive observations'; genr helpvar=xb/sigma+@mills; genr ame_p=@coef(2)*(1-@mills*helpvar) ; msd(terse) ame_p; ?stop; title '2d) Marginal effect on positive observations at the mean'; set phi=norm(xb_mean/sigma); set mills_mean=phi/pr_work_mean; set helpvar2=xb_mean/sigma+mills_mean ; set mep_mean=@coef(2)*(1-mills_mean*helpvar2); print mep_mean; ?stop ? 2 e) Marginal effects on probability of being uncensored title '2e) Average marginal effect on probability of working'; genr ame_pr=norm(xb/sigma)*@coef(2)/sigma; msd(terse) ame_pr; ?stop; title '2e) Marginal effect on probability of working at the mean'; set me_pr_mean=phi*@coef(2)/sigma; print me_pr_mean; end;