/* gs3sls *! VERSION 1.0 15dec2011 */ VERSION 11.0 INCLUDE _std_xlarge DEFINE _dlght 480 INCLUDE header HELP hlp1, view("help gs3sls") RESET res1 SCRIPT PREINIT BEGIN program parseMessage script se_createAsSvyOLS script se_setBias_on program svy_check_title END PROGRAM parseMessage BEGIN if __MESSAGE.contains("__MI__") { call script se_setMI_on } END SCRIPT POSTINIT BEGIN program check_bytab program se_setFinalInitState END PROGRAM check_bytab BEGIN if ! __MESSAGE.contains("__MI__") { call script sub_set_by_on } END SCRIPT svy_is_on BEGIN script max_setDefaultNoLog END SCRIPT svy_is_off BEGIN script max_setDefaultLog END DIALOG main, label("gs3sls- Generalized Spatial Autoregressive 3SLS Regression)") /// tabtitle("Main") BEGIN DEFINE wlabel 130 DEFINE cmdx 320 DEFINE cmdw 170 DEFINE _x _xsetbu DEFINE _y _top INCLUDE _bu_tsset TEXT tx_cmds _lft _top cmdw ., /// label("Command:") TEXT tx_ord 150 @ 70 ., /// label("Order") COMBOBOX cb_cmd _lft _ss @ ., /// label("Command") /// contents(cmd_con ) /// value(cmd_con ) /// onselchangelist(cmd_sel ) dropdownlist EDIT ed_ord 150 @ 70 ., /// label("Order") /// option("order") TEXT tx_fn1 _lft _xls 250 ., /// label("Weight Matrix File Name (dta):") TEXT tx_weights 280 @ 120 ., /// label("Spatial Weight Matrix:") TEXT tx_eigw 420 @ 115 ., /// label("Eigenvalue:") FILE fi_fn1 _lft _ss 250 ., /// label("Brows...") /// option("wmfile") /// filter("Stata dta File (*.dta)|*.dta|All (*.*)|*.*") /// defext(dta) EDIT ed_wmat 280 @ 120 ., /// label("Spatial Weight Matrix") /// option("wmat") VARNAME vn_eigw 420 @ 115 ., /// label("Eigenvalue") /// option("eigw") GROUPBOX gb_group1 _lft _xls _iwd _ht8 , TEXT tx_yvar _ilft _ss _vnwd ., /* */ label("Dependent Variable:") /* */ TEXT tx_xvar _vlx @ _cwd2 ., /* */ label("Independent Variables:") /* */ VARNAME vn_yvar _ilft _ss _vnwd ., /* */ label("Dependent Variable") /* */ VARLIST vl_xvar _vlx @ 380 ., /* */ label("Independent Variables") /* */ TEXT tx_aux _ilft _ms 230 ., /// label("Auxiliary Variables:") TEXT tx_varq 300 @ 230 ., /// label("Variables of Eq2 (GS3SLSAR):") VARLIST vl_aux _ilft _ss 230 ., /// label("Auxiliary Variables") /// option(aux) VARLIST vl_varq 300 @ 230 ., /// label("Variables of Eq2 (GS3SLSAR):") /// option(var2) GROUPBOX gb_model1 _lft _xls _ibwd _ht8 , /// label("Options:") CHECKBOX ck_stand _ilft _ss 350 ., option("stand") /* */ label("Standardized Weight Matrix and Eigenvalue") CHECKBOX ck_robust _ilft _ss 350 ., option("robust") /* */ label("robust: Use Huber-White Variance-Covariance Matrix") CHECKBOX ck_nocons _ilft _ss 400 ., option("noconstant") /* */ label("noconstant: Exclude Constant Term from RHS Equation only") CHECKBOX ck_nocong _ilft _ss 400 ., option("noconexog") /* */ label("noconexog: Exclude Constant Term from both RHS and Instrumental Equations") END DIALOG est2, tabtitle("Model2") BEGIN CHECKBOX ck_model2 _lft _top _ibwd _ht12 , /// groupbox /// onclickon(script ck_model2_on) /// onclickoff(script ck_model2_off) /// label("GS2SLS Model Options:") RADIO rb_m1 _indent _ss _inwd ., /// first /// option(run(2sls)) /// label("Two-Stage Least Squares (2SLS)") /// onclickon(script ck_gmms_off) RADIO rb_m2 @ _ss @ ., /// option(run(liml)) /// label("Limited Information Maximum Likelihood (LIML)") /// onclickon(script ck_gmms_off) RADIO rb_m3 @ _ss @ ., /// option(run(melo)) /// label("Minimum Expected Loss (MELO)") /// onclickon(program ck_gmms_off) RADIO rb_m4 @ _ss @ ., /// option(run(fuller)) /// label("Fuller k - Class LIML") /// onclickon(script fuller_on) EDIT ed_fuller 170 @ 70 ., /* */ label("fuller") /* */ option("kf") TEXT tx_fuler 250 @ 70 ., /* */ label("k-Class Value") /* */ RADIO rb_m5 _ilft _ms _iwd ., /// option(run(kclass)) /// label("Theil k - Class LIML") /// onclickon(script kclass_on) EDIT ed_kclass 170 @ 70 ., /* */ label("kclass") /* */ option("kc") TEXT tx_kclass 250 @ 100 ., /* */ label("k-Class Value") /* */ RADIO rb_m6 _ilft _ss _iwd ., /// last /// option(run(gmm)) /// label("Generalized Method of Moments (GMM)") /// onclickon(script ck_gmms_on) GROUPBOX gb_optgmm _lft _ls _ibwd _ht9 , /// label("GMM - Generalized Method of Moments Options:") RADIO rb_g0 _ilft _ss 300 ., /* */ label("White Method") /* */ first /* */ option("hetcov(white)") /* */ DEFINE y @y RADIO rb_g1 _ilft _ss 300 ., /* */ label("Bartlet Method") /* */ option("hetcov(bart)") /* */ RADIO rb_g2 _ilft _ss 300 ., /* */ label("Daniell Method") /* */ option("hetcov(dan)") /* */ RADIO rb_g3 _ilft _ss 300 ., /* */ label("Newey-West Method") /* */ option("hetcov(nwest)") /* */ RADIO rb_g4 _ilft _ss 300 ., /* */ label("Parzen Method") /* */ option("hetcov(parzen)") /* */ RADIO rb_g5 _ilft2 y 300 ., /* */ label("Quadratic spectral Method") /* */ option("hetcov(quad)") /* */ RADIO rb_g6 @ _ss 300 ., /* */ label("Tent Method") /* */ option("hetcov(tent)") /* */ RADIO rb_g7 @ _ss 300 ., /* */ label("Truncated Method") /* */ option("hetcov(trunc)") /* */ RADIO rb_g8 @ _ss 300 ., /* */ label("Tukey-Hamming Method") /* */ option("hetcov(tukeym)") /* */ RADIO rb_g9 @ _ss 300 ., /* */ label("Tukey-Hanning Method") /* */ last /* */ option("hetcov(tukeyn)") /* */ CHECKBOX ck_model3 _lft _ms _ibwd _ht9 , /// groupbox /// onclickon(script ck_model3_on) /// onclickoff(script ck_model3_off) /// label("GS3SLS Model Options:") RADIO rb_3sls _ilft _ss _ibwd ., /// label("Three-Stage Least Squares [3SLS]") /// first /// option(NONE) RADIO rb_2sls @ _ss @ ., /// label("Two-Stage Least Squares [2SLS]") /// option("2sls") RADIO rb_ols _ilft _ss @ ., /// label("Ordinary Least Squares [OLS]") /// option("ols") RADIO rb_sure @ _ss @ ., /// label("Seemingly Unrelated Regression [SURE]") /// option("sure") RADIO rb_mvreg @ _ss @ ., /// last /// option("mvreg") /// label("SURE with OLS Degree-of-Freedom Adjustment [MVReg]") GROUPBOX gb_opt _lft _ss _ibwd _ht4 , /* */ label("Options:") /* */ CHECKBOX ck_fstage _ilft _ss 300 ., option("first") /* */ label("first: Report First-Stage Regression") */ CHECKBOX ck_small _ilft _ss 300 ., option("small") /* */ label("small: Report , F Tests instead of Z, Chi2 Tests") END LIST cmd_con BEGIN spgls -------------- gs2sls gs2slsar -------------- gs3sls gs3slsar -------------- END LIST cmd_sel BEGIN script spgls_on script gs2sls_on script gs2slsar_on script gs3sls_on script gs3slsar_on END SCRIPT ck_model2_on BEGIN est2.rb_m1.enable est2.rb_m2.enable est2.rb_m3.enable est2.rb_m4.enable est2.rb_m5.enable est2.rb_m6.enable END SCRIPT ck_model2_off BEGIN est2.rb_m1.disable est2.rb_m2.disable est2.rb_m3.disable est2.rb_m4.disable est2.rb_m5.disable est2.rb_m6.disable END SCRIPT fuller_on BEGIN est2.ed_fuller.enable est2.ed_kclass.disable END SCRIPT fuller_off BEGIN est2.ed_fuller.disable est2.ed_kclass.disable END SCRIPT kclass_on BEGIN est2.ed_fuller.disable est2.ed_kclass.enable END SCRIPT kclass_off BEGIN est2.ed_fuller.disable est2.ed_kclass.disable END SCRIPT ck_gmms_on BEGIN est2.rb_g0.enable est2.rb_g1.enable est2.rb_g2.enable est2.rb_g3.enable est2.rb_g4.enable est2.rb_g5.enable est2.rb_g6.enable est2.rb_g7.enable est2.rb_g8.enable est2.rb_g9.enable END SCRIPT ck_gmms_off BEGIN est2.rb_g0.disable est2.rb_g1.disable est2.rb_g2.disable est2.rb_g3.disable est2.rb_g4.disable est2.rb_g5.disable est2.rb_g6.disable est2.rb_g7.disable est2.rb_g8.disable est2.rb_g9.disable END SCRIPT ck_model3_on BEGIN est2.rb_3sls.enable est2.rb_2sls.enable est2.rb_sure.enable est2.rb_mvreg.enable est2.rb_ols.enable est2.ck_fstage.enable est2.ck_small.enable END SCRIPT ck_model3_off BEGIN est2.rb_3sls.disable est2.rb_2sls.disable est2.rb_sure.disable est2.rb_mvreg.disable est2.rb_ols.disable est2.ck_fstage.disable est2.ck_small.disable END INCLUDE byifin INCLUDE weights_fpai INCLUDE se PROGRAM command BEGIN put /program by_output put "gs3sls " varlist main.vn_yvar [main.vl_xvar] put " " /program ifin_output put " " /program weights_output put /program se_prefix_output require main.fi_fn1 require main.ed_wmat require main.vn_eigw beginoptions optionarg main.fi_fn1 optionarg main.ed_wmat optionarg main.vn_eigw put " model(" main.cb_cmd ") " optionarg main.ed_ord optionarg main.vl_varq optionarg main.vl_aux option main.ck_stand option main.ck_robust option main.ck_nocons option main.ck_nocong optionarg est2.ed_fuller optionarg est2.ed_kclass option radio(est2 rb_m1 rb_m2 rb_m3 rb_m4 rb_m5 rb_m6) option est2.ck_fstage option est2.ck_small option radio(est2 rb_ols rb_mvreg rb_sure rb_2sls rb_3sls) option radio(est2 rb_g0 rb_g1 rb_g2 rb_g3 rb_g4 rb_g5 rb_g6 rb_g7 rb_g8 rb_g9) put " " /program se_output endoptions END