📄 ml_technique.ado
字号:
*! version 1.1.4 04mar2005
program ml_technique, sclass
version 8.0
// parse the -technique()- and -vce()- options of -ml-
syntax [, ///
TECHnique(string) ///
VCE(string) ///
noDEFault ///
]
sreturn clear
// saved results:
// s(vce)
gettoken vcetype vcerest : vce, parse(",")
if `"`vcerest'"' != "" {
di as err "option vce(`vce') not allowed"
exit 198
}
capture get_vce , `vcetype'
if c(rc) {
if "`s(message)'" == "" {
di as err "option vce(`vce') not allowed"
}
exit c(rc)
}
// saved results:
// s(techlist)
// s(numlist)
// s(technique)
get_technique `technique', `default'
end
program get_vce, sclass
sreturn local message ""
syntax [, ///
Hessian /// VCE types
OIM ///
Opg ///
NATIVE ///
Robust ///
]
// OIM is a synonym for Hessian
if "`hessian'" != "" {
local oim oim
}
local vce `oim' `opg' `native' `robust'
if `: word count `vce'' > 1 {
local vce : list retok vce
di as err "options `vce' may not be combined in vce()"
exit 198
}
if "$ML_vce" == "robust" & !inlist("`vce'", "", "oim", "robust") {
di as err "options robust and vce(`vce') may not be combined"
sreturn local message message
exit 198
}
sreturn local vce `vce'
end
// Syntax:
// get_technique [ tname [#] ]...
//
// NOTE: The default value of # is 1.
// NOTE: The order of the arguments is preserved on purpose.
//
// Saved results:
//
// s(techlist) list of <tname>s in order given
// s(numlist) list of #s in order given, with default #s
// s(technique) retokenized arguments, with default #s
//
program get_technique, sclass
syntax [anything(equalok)] [, noDEFault ]
local 0 `"`anything'"'
if "`default'" == "" {
local default_num 5
}
else local default_num 0
gettoken tname rest : 0, parse(" =")
while "`tname'" != "" {
local tname = lower(`"`tname'"')
capture confirm name `tname'
if _rc {
local rc = _rc
di as err ///
"`tname' is an invalid name in technique() option"
exit `rc'
}
get_tech tech , `tname'
gettoken num : rest, parse(" =")
if "`num'" == "=" {
// remove optional "=", UNDOCUMENTED
gettoken num rest : rest, parse(" =")
gettoken num : rest, parse(" =")
}
capture confirm integer number `num'
if !_rc gettoken num rest : rest, parse(" =")
else local num `default_num'
if `num' < 0 {
di as err ///
"negative integers are not allowed in technique() option"
exit 125
}
else if `num' > 0 {
local techlist `techlist' `tech'
local numlist `numlist' `num'
local technique `technique' `tech' `num'
}
else if "`default'" != "" {
local techlist `techlist' `tech'
local numlist `numlist' `num'
local technique `technique' `tech'
}
gettoken tname rest : rest, parse(" =")
}
if "`default'`techlist'" == "" {
local techlist nr
local numlist `default_num' // will be ignored
}
if "`default'" == "" {
sreturn local techlist `:list retok techlist'
sreturn local numlist `:list retok numlist'
}
sreturn local technique `:list retok technique'
end
program get_tech
syntax name(id="macro name") [, ///
BHHH /// current valid techniques
BHHHQ ///
BFGS ///
DFP ///
NR ///
* /// invalid technique
]
if "`options'" != "" {
di as err ///
"`options' is not a valid argument of technique() option"
exit 198
}
c_local `namelist' `bhhh' `bhhhq' `bfgs' `dfp' `nr'
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -