Introductory Stata 51: Marginsplots after IV Estimation

Описание к видео Introductory Stata 51: Marginsplots after IV Estimation

After fitting a linear regression model with the instrumental variables method using the command "ivregress," we can call the postestimation commands to perform tests or report statistics. In previous videos, we have learned "estat firststage, estat endogenous, and estat overid." In this video, let me show you how to visualize the fitted values and the marginal effects after instrumental variables estimation.
Let's continue to use the dataset for the US female workers. You can download the dataset from the link below.
https://drive.google.com/file/d/1kncw...

#ivregress #eregress #eprobit #margins

**************************************
*51. Marginsplot after IV estimation *
**************************************
capture log close
log using iv2.log, text replace

set showbaselevels on

*Use the dataset I created for US female workers
use "https://bobwen.weebly.com/uploads/1/3...", clear
describe
summarize

*Linear model
*OLS
regress lwage c.schooling i.region i.race c.age##c.age

margins, at(schooling=(7/17)) saving(OLS_pre, replace)

*IV
ivregress 2sls lwage (schooling=i.parent_edu) i.region i.race c.age##c.age, first

margins, at(schooling=(7/17)) saving(IV_pre, replace)

*Combine marginsplots
combomarginsplot OLS_pre IV_pre, file1opts(mcolor(blue) lcolor(blue)) file2opts(mcolor(orange) lcolor(orange) lpatter(dash)) xtitle(Years of Schooling)

*use eregress for IV estimation
eregress lwage i.region i.race c.age##c.age, endogenous(c.schooling=i.parent_edu i.region i.race c.age##c.age)

margins, at(schooling=(7/17)) saving(IV_pre, replace) predict(fix(schooling))

combomarginsplot OLS_pre IV_pre, file1opts(mcolor(blue) lcolor(blue)) file2opts(mcolor(orange) lcolor(orange) lpatter(dash)) xtitle(Years of Schooling)

*Nonlinear model
*Probit
probit LFP schooling num_children i.race
margins, dydx(schooling) atmeans
margins, at(schooling=(7/17)) saving(Probit_pre, replace)
margins, dydx(schooling) at(schooling=(7/17)) saving(Probit_me, replace)

*eprobit
eprobit LFP num_children i.race, endogenous(schooling=i.parent_edu num_children i.race)
margins, dydx(schooling) atmeans predict(fix(schooling))
margins, at(schooling=(7/17)) saving(IVpro_pre, replace) predict(fix(schooling))
margins, dydx(schooling) at(schooling=(7/17)) saving(IVpro_me, replace) predict(fix(schooling))

*Multiple marginsplots
*fitted values
combomarginsplot Probit_pre IVpro_pre, file1opts(mcolor(blue) lcolor(blue)) file2opts(mcolor(orange) lcolor(orange) lpatter(dash)) xtitle(Years of Schooling)

*marginal effects
combomarginsplot Probit_me IVpro_me, file1opts(mcolor(blue) lcolor(blue)) file2opts(mcolor(orange) lcolor(orange) lpatter(dash)) xtitle(Years of Schooling)


log close

Комментарии

Информация по комментариям в разработке