📄 xtreg.ado
字号:
*! version 1.5.1 31mar2005
program define xtreg, eclass byable(recall) sort
version 6, missing
local version : di "version " string(_caller()) ", missing:"
if replay() {
if `"`e(cmd)'"'==`"xtreg"' {
if _by() { error 190 }
xtreg_`e(model)' `0'
exit `e(rc)'
}
else if `"`e(cmd2)'"' == "xtreg" {
if _by() { error 190 }
`e(cmd)' `0'
exit `e(rc)'
}
error 301
/*NOTREACHED*/
}
syntax varlist(ts) [if] [iw fw pw] [, ///
I(varname) BE FE RE MLE PA GEE ///
VCE(passthru) ///
* ///
]
if _by() & `"`vce'"' != "" {
di as err "the by prefix may not be used with vce() option"
exit 198
}
if `"`vce'"' != "" {
local options `"`options' `vce'"'
}
marksample touse
if "`gee'" != "" { local pa "pa " }
if ("`be'"!="")+("`fe'"!="")+("`re'"!="")+("`pa'"!="")>1 {
di in red "choose only one of be, fe, re, or pa"
exit 198
}
if `"`be'"'!=`""' | `"`fe'"'!=`""' {
if `"`mle'"'!=`""' | `"`pa'"'!=`""' { error 198 }
}
else {
if `"`mle'"'!=`""' & `"`pa'"'!=`""' { error 198 }
}
/* check collinearity */
xt_iis `i'
local ivar "`s(ivar)'"
qui _rmcoll `varlist'
local retlist `r(varlist)' `ivar'
qui _rmcoll `retlist'
if "`r(varlist)'" ~= "`retlist'" {
di as err "independent variables " _c
di as err "are collinear with the panel variable" _c
di as err " `ivar'"
exit 198
}
local options `options' i(`i')
if `"`be'"'!=`""' {
if "`weight'" != "" {
di in red "`weight' not allowed with be model"
exit 101
}
`version' ///
xtreg_be `varlist' if `touse' /* [`weight'`exp'] */, ///
be `options'
}
else if `"`fe'"'!=`""' {
if "`weight'" != "" {
di in red "`weight' not allowed with fe model"
exit 101
}
`version' ///
xtreg_fe `varlist' if `touse' /* [`weight'`exp'] */, ///
fe `options'
}
else {
if `"`mle'"' == `""' & `"`pa'"' == `""' {
if "`weight'" != "" {
di in red "`weight' not allowed with re model"
exit 101
}
`version' ///
xtreg_re `varlist' if `touse' ///
/* [`weight'`exp']*/ , re `options'
exit
}
if `"`mle'"' == `""' {
`version' ///
xtgee `varlist' if `touse' [`weight'`exp'], ///
`options'
est local predict xtreg_pa_p
est local estat_cmd "" // reset from xtgee
est local cmd2 "xtreg"
est local model "pa"
exit
}
else {
`version' ///
xtreg_ml `varlist' if `touse' [`weight'`exp'], ///
mle `options'
}
}
exit `e(rc)'
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -