/* spautoreg *! VERSION 4.0 15jan2012 */ VERSION 10.0 INCLUDE _std_xlarge DEFINE _dlght 433 INCLUDE header HELP hlp1, view("help spautoreg") 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("spautoreg- Spatial Regression (Lag - Error - Durbin - SAC - IV - Tobit)") /// 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:") COMBOBOX cb_cmd @ _ss @ ., /// label("Command") /// contents(cmd_con ) /// value(cmd_con ) /// onselchangelist(cmd_sel ) dropdownlist TEXT tx_fn1 _lft _ms 250 ., /// label("Input W File Name (dta):") TEXT tx_weights 280 @ 150 ., /// label("Spatial Weight Matrix:") TEXT tx_eigw 410 @ 150 ., /// label("Eigenvalue:") FILE fi_fn1 _lft _ss 290 ., /// label("Brows...") /// option("wmfile") /// filter("Stata dta File (*.dta)|*.dta|All (*.*)|*.*") /// defext(dta) EDIT mname_weights 320 @ 100 ., /// label("wmat") /// option("wmat") VARNAME vn_eigw 430 @ 100 ., /// label("Eigenvalue") /// option("eigw") GROUPBOX gb_group1 _lft _ss _iwd _ht4 , TEXT tx_yvar _ilft +15 _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") /* */ GROUPBOX gb_group3 _lft _ls _iwd _ht3, /* */ label("") TEXT tx_wrho _ilft +10 140 ., /// label("SAC Weight Matrix (wrho)") TEXT tx_eigwrho 170 @ 140 ., /// label("SAC Eigenvalue (eigwrho)") TEXT tx_mhet 330 @ 200 ., /// label("Heteroscedasticity Variables:") EDIT mname_wrho _ilft _ss 140 ., /// label("SAC Weight Matrix (wrho)") /// option(wrho) VARNAME vn_eigwrho 170 @ 140 ., /* */ label("SAC Eigenvalue (eigwrho)") /* */ option(eigwrho) VARLIST vl_mhet 330 @ 200 ., /* */ label("Heteroscedasticity Variables:") /* */ option(mhet) GROUPBOX gb_optdst _lft _ls _iwd _ht2 , /* */ label("Distribution:") /* */ RADIO rb_d1 _ilft _ss 100 ., /* */ label("Normal") /* */ clickon(program main_gmm_on) /* */ first /* */ option("dist(norm)") /* */ RADIO rb_d2 120 @ 100 ., /* */ label("Exponential") /* */ clickon(program main_gmm_on) /* */ option("dist(exp)") /* */ RADIO rb_d3 220 @ 100 ., /* */ label("Weibull") /* */ clickon(program main_gmm_on) /* */ last /* */ option("dist(weib)") /* */ GROUPBOX gb_group4 _lft +33 _iwd _ht2, /* */ label("Spatial Autocorrelation Coefficient Type: " " " "Total, Direct, and Indirect Marginal Effects:") /* */ CHECKBOX ck_sprho _indent _ss 100 ., option("spar(rho)") /* */ label("Rho") /* */ DEFINE y @y CHECKBOX ck_splam 120 y @ ., option("spar(lam)") /* */ label("Lambda") /* */ CHECKBOX ck_lin 250 y 100 ., option("mfx(lin)") /* */ label("Linear") /* */ DEFINE y @y CHECKBOX ck_log 350 y @ ., option("mfx(log)") /* */ label("Log-Log") /* */ GROUPBOX gb_group5 _lft +33 _iwd _ht3 , /* */ label("Specify Positive Value for Initial Values:") /* */ CHECKBOX ck_inrho _ilft _ms 120 ., /* */ clickon("gaction main.sp_inrho.enable") /* */ clickoff("gaction main.sp_inrho.disable") SPINNER sp_inrho _cksep @ _spwd ., /* */ min(0) max(1) default(0.1) /* */ option("inrho") /* */ label("inrho") TEXT tx_inrho _spsep @ _sprb ., /* */ label("Rho") DEFINE y @y CHECKBOX ck_inlam 140 y _ckwd ., /* */ clickon("gaction main.sp_inlam.enable") /* */ clickoff("gaction main.sp_inlam.disable") SPINNER sp_inlam _cksep @ _spwd ., /* */ min(0) max(1) default(0.1) /* */ option("inlambda") /* */ label("inlambda") TEXT tx_inlam _spsep @ _sprb ., /* */ label("Lambda") CHECKBOX ck_ord 280 y _ckwd ., /* */ clickon("gaction main.sp_ord.enable") /* */ clickoff("gaction main.sp_ord.disable") SPINNER sp_ord _cksep @ _spwd ., /* */ min(0) max(4) default(1) /* */ option("order") /* */ label("Order") TEXT tx_ord _spsep @ _sprb ., /* */ label("Order") CHECKBOX ck_wlag 400 y _ckwd ., /* */ clickon("gaction main.sp_wlag.enable") /* */ clickoff("gaction main.sp_wlag.disable") SPINNER sp_wlag _cksep @ _spwd ., /* */ min(0) max(4) default(1) /* */ option("wxlag") /* */ label("WXLag") TEXT tx_wlag _spsep @ _sprb ., /* */ label("WXLag") */ DEFINE _x _lft DEFINE _y +35 DEFINE _cx _lw80 DEFINE _bux _slw80 INCLUDE _constraints END DIALOG est1, tabtitle("Model1") BEGIN GROUPBOX gb_model1 _lft _top _ibwd _ht18 , /// label("SPAUTO Results Report:") CHECKBOX ck_stand _ilft _ss 350 ., option("stand") /* */ label("Use Standardized Weight Matrix and Eigenvalue") CHECKBOX ck_lmspac _ilft _ss 350 ., option("lmspac") /* */ label("Spatial Autocorrelation Tests") CHECKBOX ck_lmauto _ilft _ss 350 ., option("lmauto") /* */ label("Serial Autocorrelation Tests") CHECKBOX ck_lmhet _ilft _ss 350 ., option("lmhet") /* */ label("Heteroscedasticity Tests") CHECKBOX ck_lmnorm _ilft _ss 350 ., option("lmnorm") /* */ label("Non Normality Tests") CHECKBOX ck_lmiden _ilft _ss 350 ., option("lmiden") /* */ label("Identification Restrictions LM Tests") CHECKBOX ck_reset _ilft _ss 350 ., option("reset") /* */ label("REgression Specification Error Tests (RESET)") CHECKBOX ck_alltest _ilft _ss 350 ., option("alltest") /* */ label("Display ALL Tests") CHECKBOX ck_robust _ilft _ss 350 ., option("robust") /* */ label("robust: Use Huber-White Variance-Covariance Matrix") GROUPBOX gb_mlopt _lft _ls _ibwd _ht2 , /// label("SPML Options:") EDIT ed_grids _ilft _ss 50 ., /* */ label("gridsearch") /* */ option("grids") TEXT tx_grids 80 @ 120 ., /* */ label("Grid Search Initial Values") GROUPBOX gb_gsopt _lft _ls _ibwd _ht5 , /// label("SPGS / SPIV Options:") EDIT ed_impower _ilft _ss 50 ., /* */ label("impower") /* */ option("impower") TEXT tx_impower 80 @ 120 ., /* */ label("Impower Initial Values") CHECKBOX ck_hetero _ilft _ls 300 ., option("hetero") /* */ label("Use Heterockedasticy Model, default Homoscedasticity") GROUPBOX gb_ivtob _lft _ls _ibwd _ht4 , /// label("IVTobit Options:") CHECKBOX ck_twostep _ilft _ss 300 ., option("twostep") /* */ label("twostep: Use Newey's Two-Step Estimator; default is MLE") CHECKBOX ck_first _ilft _ss 300 ., option("first") /* */ label("first: Report First-Stage Tests") */ END DIALOG est2, tabtitle("Model2") BEGIN CHECKBOX ck_model2 _lft _top _ibwd _ht8 , /// groupbox /// onclickon(script ck_model2_on) /// onclickoff(script ck_model2_off) /// label("GS2SLS Model Options:") RADIO rb_liml _ilft _ss _cwd2 ., /* */ label("Limited-Information Maximum Likelihood") /* */ first /* */ option("liml") /* */ RADIO rb_gmm _ilft _ss _cwd2 ., /* */ label("Generalized Method of Moments (GMM)") /* */ option("gmm") /* */ RADIO rb_gmms _ilft _ss _cwd2 ., /* */ label("2SLS-GMM (gmm2s)") /* */ option("gmm2s") /* */ RADIO rb_cue _ilft _ss _cwd2 ., /* */ label("Continuously Updated Estimation GMM (CUE)") /* */ last /* */ option("cue") /* */ EDIT ed_fuller _ilft _xls _spwd ., /* */ label("fuller") /* */ option("fuller") TEXT tx_fuller _spsep @ _rbsprb ., /* */ label("Fuller's LIML") /* */ EDIT ed_kclass _ilft _ls _spwd ., /* */ label("kclass") /* */ option("kclass") TEXT tx_kclass _spsep @ _rbsprb ., /* */ label("k-Klass LIML") /* */ EDIT ed_bw _ilft _ls _spwd ., /* */ label("bw") /* */ option("bw") TEXT tx_bw _spsep @ _rbsprb ., /* */ label("bw AC or HAC BandWidth Covariance Matrix") GROUPBOX gb_gr3 _lft _ls _ibwd _ht12 , /* */ label("") /* */ CHECKBOX ck_robust _ilft _ss 300 ., option("robust") /* */ label("robust: Use Eicker/Huber/White/Sandwich Covariance Matrix") */ CHECKBOX ck_coviv _ilft _ss 300 ., option("coviv") /* */ label("coviv: Use 2SLS Covariance Matrix for LIML or k-Class") */ CHECKBOX ck_rf _ilft _ss 300 ., option("rf") /* */ label("rf: Display Reduced Form") */ CHECKBOX ck_fstage _ilft _ss 300 ., option("first") /* */ label("first: Report First-Stage Regression") */ CHECKBOX ck_ffirst _ilft _ss 300 ., option("ffirst") /* */ label("ffirst: Report First-Stage Tests") */ CHECKBOX ck_small _ilft _ss 300 ., option("small") /* */ label("small: Report , F Tests instead of Z, Chi2 Tests") */ TEXT tx_endog _ilft _ls 150 ., /// label("Endogeneity LM Test:") TEXT tx_exog 175 @ 150 ., /// label("Eexogeneity LM Test:") TEXT tx_rednt 335 @ 150 ., /// label("Redundant Eexogeneity Test:") VARLIST vl_endog _ilft _ss 150 ., /// label("endog") /// option(endog) VARLIST vl_exog 175 @ 150 ., /// label("exog") /// option(orthog) VARLIST vl_rednt 335 @ 150 ., /// label("rednt") /// option(redundant) END DIALOG est3, tabtitle("Model3") BEGIN CHECKBOX ck_model2 _lft _top _ibwd _ht10 , /// 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 _xls _ibwd _ht4, /* */ label("Options:") /* */ CHECKBOX ck_fstage _ilft _ss 300 ., option("first") /* */ label("first: Report First-Stage Regression") */ CHECKBOX ck_allexog _ilft _ss 300 ., option("allexog") /* */ label("allexog: All Right-Hand-Side Variables are Exogenous") */ END LIST cmd_con BEGIN lag error durbin sac -------------- gs2sls gs3sls -------------- ivtobit -------------- spgls spgsar -------------- spml spgs spiv END LIST cmd_sel BEGIN script lag_on script error_on script durbin_on script sac_on script gs2sls_on script gs3sls_on script ivtobit_on script spgls_on script spgsar_on script spml_on script spgs_on script spiv_on END SCRIPT ck_model2_on BEGIN est2.rb_liml.enable est2.rb_gmm.enable est2.rb_gmms.enable est2.rb_cue.enable END SCRIPT ck_model2_off BEGIN est2.rb_liml.disable est2.rb_gmm.disable est2.rb_gmms.disable est2.rb_cue.disable END SCRIPT ck_model3_on BEGIN est3.rb_3sls.enable est3.rb_2sls.enable est3.rb_sure.enable est3.rb_mvreg.enable est3.rb_ols.enable END SCRIPT ck_model3_off BEGIN est3.rb_3sls.disable est3.rb_2sls.disable est3.rb_sure.disable est3.rb_mvreg.disable est3.rb_ols.disable END INCLUDE byifin INCLUDE weights_fpai INCLUDE se INCLUDE _constraints_sc INCLUDE max_ml PROGRAM command BEGIN put /program by_output put "spautoreg " 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.mname_weights require main.vn_eigw beginoptions optionarg main.fi_fn1 optionarg main.mname_weights optionarg main.vn_eigw put " model(" main.cb_cmd ") " optionarg main.mname_wrho optionarg main.vn_eigwrho optionarg main.vl_mhet option radio(main rb_d1 rb_d2 rb_d3) option main.ck_splam option main.ck_sprho option main.ck_lin option main.ck_log optionarg main.sp_inlam optionarg main.sp_inrho optionarg main.sp_ord optionarg main.sp_wlag option est1.ck_twostep option est1.ck_first option est1.ck_stand option est1.ck_lmspac option est1.ck_lmauto option est1.ck_lmhet option est1.ck_lmnorm option est1.ck_lmiden option est1.ck_reset option est1.ck_alltest option est1.ck_robust option est1.ck_hetero optionarg est1.ed_grids optionarg est1.ed_impower option est2.ck_coviv option est2.ck_fstage option est2.ck_ffirst option est2.ck_small option est2.ck_rf option est2.ck_robust optionarg est2.ed_bw optionarg est2.ed_fuller optionarg est2.ed_kclass optionarg est2.vl_endog optionarg est2.vl_exog optionarg est2.vl_rednt option radio(est2 rb_liml rb_gmm rb_gmms rb_cue) option est3.ck_fstage option est3.ck_allexog option radio(est3 rb_ols rb_mvreg rb_sure rb_2sls rb_3sls) INCLUDE _constraints_main_pr put " " /program se_output put " " /program max_output endoptions END