|
|
| program reghdfe5_parse, sclass
|
|
|
|
|
| cap drop __hdfe*
|
| ms_parse_absvars `0'
|
| loc extended_absvars `"`s(extended_absvars)'"'
|
| mata: st_local("unquoted_absvars", subinstr(st_global("s(absvars)"), `"""', ""))
|
| loc 0, `s(options)'
|
| loc G = `s(G)'
|
|
|
|
|
| #d;
|
| syntax, [
|
|
|
|
|
| RESiduals(name) RESiduals2
|
|
|
|
|
| TOLerance(real -1)
|
| MAXITerations(real -1)
|
| ALGorithm(string)
|
| TRAnsform(string)
|
| ACCELeration(string)
|
| SLOPEmethod(string)
|
| PRUNE
|
| PRECONDition
|
|
|
|
|
| POOLsize(integer 0)
|
|
|
|
|
| DOFadjustments(string)
|
| GROUPVar(name)
|
|
|
| CONDition
|
| RRE(varname)
|
| noCONstant
|
|
|
|
|
| KEEPSINgletons
|
| Verbose(numlist min=1 max=1 >=-1 <=5 integer)
|
|
|
| ] [*]
|
| ;
|
| #d cr
|
|
|
| if ("`keepsingletons'"!="") sreturn loc drop_singletons = 0
|
| if ("`verbose'"!="") sreturn loc verbose = `verbose'
|
| sreturn loc report_constant = "`constant'" != "noconstant"
|
|
|
| sreturn loc options `"`options'"'
|
|
|
| assert "$reghdfe_touse" != ""
|
| cap conf var $reghdfe_touse
|
| if (c(rc)) gen byte $reghdfe_touse = 1
|
| markout $reghdfe_touse `unquoted_absvars', strok
|
|
|
|
|
| loc maxiterations = int(`maxiterations')
|
| if (`tolerance' > 0) sreturn loc tolerance = `tolerance'
|
| if (`maxiterations' > 0) sreturn loc maxiter = `maxiterations'
|
|
|
|
|
| if ("`transform'" != "") {
|
| loc transform = lower("`transform'")
|
| loc valid_transforms cimmino kaczmarz symmetric_kaczmarz rand_kaczmarz
|
| foreach x of local valid_transforms {
|
| if (strpos("`x'", "`transform'")==1) loc transform `x'
|
| }
|
| _assert (`: list transform in valid_transforms'), msg("invalid transform: `transform'")
|
| sreturn loc transform "`transform'"
|
| }
|
|
|
|
|
| if ("`acceleration'" != "") {
|
| loc acceleration = lower("`acceleration'")
|
| if ("`acceleration'"=="cg") loc acceleration conjugate_gradient
|
| if ("`acceleration'"=="sd") loc acceleration steepest_descent
|
| if ("`acceleration'"=="off") loc acceleration none
|
| loc valid_accelerations conjugate_gradient steepest_descent aitken none hybrid lsmr
|
| foreach x of local valid_accelerations {
|
| if (strpos("`x'", "`acceleration'")==1) loc acceleration `x'
|
| }
|
| _assert (`: list acceleration in valid_accelerations'), msg("invalid acceleration: `acceleration'")
|
| sreturn loc acceleration "`acceleration'"
|
| }
|
|
|
|
|
| if ("`prune'" == "prune") sreturn loc prune = 1
|
|
|
|
|
| if ("`dofadjustments'"=="") local dofadjustments all
|
| loc 0 , `dofadjustments'
|
| syntax, [ALL NONE] [FIRSTpair PAIRwise] [CLusters] [CONTinuous]
|
| local opts `pairwise' `firstpair' `clusters' `continuous'
|
| local n : word count `opts'
|
| local first_opt : word 1 of `opt'
|
| opts_exclusive "`all' `none'" dofadjustments
|
| opts_exclusive "`pairwise' `firstpair'" dofadjustments
|
| opts_exclusive "`all' `first_opt'" dofadjustments
|
| opts_exclusive "`none' `first_opt'" dofadjustments
|
| if ("`none'" != "") local opts
|
| if ("`all'" != "") local opts pairwise clusters continuous
|
|
|
|
|
|
|
|
|
| if ("`groupvar'"!="") conf new var `groupvar'
|
| sreturn loc dofadjustments "`opts'"
|
| sreturn loc groupvar "`groupvar'"
|
|
|
|
|
| if ("`residuals2'" != "") {
|
| _assert ("`residuals'" == ""), msg("residuals() syntax error")
|
| cap drop _reghdfe_resid
|
| sreturn loc residuals _reghdfe_resid
|
| }
|
| else if ("`residuals'"!="") {
|
| conf new var `residuals'
|
| sreturn loc residuals `residuals'
|
| }
|
|
|
|
|
| if ("`condition'"!="") {
|
| _assert `G'==2, msg("Computing finite condition number requires two FEs")
|
| sreturn loc finite_condition 1
|
| }
|
|
|
| sreturn loc compute_rre = ("`rre'" != "")
|
| if ("`rre'" != "") {
|
| sreturn loc rre `rre'
|
| }
|
|
|
| if (`poolsize' < 1) loc poolsize .
|
| sreturn loc poolsize `poolsize'
|
|
|
| sreturn loc precondition = "`precondition'" != ""
|
| end
|
|
|