如何处理did_imputation命令中的r(123) ?



我在Stata中运行did_imputation command,并面临ms_get_version错误。我遵循Statalist的讨论,运行下面的代码来修复:

ssc install ftools 

然而,在那之后,当我运行did_imputation时,我遇到了r(123)的问题。我看了看周围,他们说这可能是由于名称编码,变量的数量....然而,这些都不是我的问题。我只有100万次观测,而我的Stata包允许我多达10亿次观测。

我想知道是否有什么指导可以帮助我整理。

did_imputation lnq_r id2 ndate nbanned_date, horizons(0/10) pretrend(10)

我试着看看变量,我确信它们都是数字或已经通过使用encode编码为数字。

更新:

从@NickCox学习代码后,我得到了下面的结果,我仍然不确定发生了什么导致我的错误,从我所看到的,似乎错误来自时间维度,但很明显,这两个时间维度在方程下写日期DMY格式,所以不应该是非整数

----------------------------------------------------------------------------------------------------------------------------------------------------- begin did_imputation ---
- version 13.0
- syntax varlist(min=4 max=4) [if] [in] [aw iw] [, wtr(varlist) sum Horizons(numlist >=0) ALLHorizons HBALance minn(integer 30) shift(integer 0) AUTOSample SAVEestimates(name
> ) SAVEWeights LOADWeights(varlist) AVGEFFectsby(varlist) fe(string) Controls(varlist) UNITControls(varlist) TIMEControls(varlist) CLUSter(varname) leaveout tol(real 0.000001)
>  maxit(integer 100) verbose nose PREtrends(integer 0) delta(integer 0) alpha(real 0.05)]
- qui {
- if ("`verbose'"!="") noi di "Starting"
= if (""!="") noi di "Starting"
- ms_get_version reghdfe, min_version("5.7.3")
ms_get_version ftools, min_version("2.37.0")
marksample touse, novarlist
if ("`controls'"!="") markout `touse' `controls'
if ("`unitcontrols'"!="") markout `touse' `unitcontrols'
if ("`timecontrols'"!="") markout `touse' `timecontrols'
if ("`cluster'"!="") markout `touse' `cluster', strok
if ("`saveestimates'"!="") confirm new variable `saveestimates'
if ("`saveweights'"!="") confirm new variable `saveweights'
if ("`verbose'"!="") noi di "#00"
tempvar wei
if ("`weight'"=="") {
gen `wei' = 1
local weiexp ""
}
else {
gen `wei' `exp'
replace `wei' = . if `wei'==0
markout `touse' `wei'
if ("`sum'"=="") {
sum `wei' if `touse'
replace `wei' = `wei' * r(N)/r(sum)
}
local weiexp "[`weight'=`wei']"
}
local debugging = ("`verbose'"=="verbose")
tokenize `varlist'
local Y `1'
local i `2'
local t `3'
local ei `4'
markout `touse' `Y' `t'
markout `touse' `i', strok
tempvar D K
if ("`fe'"=="") local fe `i' `t'
if ("`fe'"==".") {
tempvar constant
gen `constant' = 1
local fe `constant'
}
local fecount = 0
foreach fecurrent of local fe {
if (("`fecurrent'"!="`i'" | "`unitcontrols'"=="") & ("`fecurrent'"!="`t'" | "`timecontrols'"=="")) {
local ++fecount
local fecopy `fecopy' `fecurrent'
local fe`fecount' = subinstr("`fecurrent'","#"," ",.)
markout `touse' `fe`fecount'', strok
}
}
local fe `fecopy'
if (`delta'==0) {
cap tsset, noquery
if (_rc==0) {
if (r(timevar)=="`t'") {
local delta = r(tdelta)
if (`delta'!=1) noi di "Note: setting delta = `delta'"
}
}
else local delta = 1
}
if (`delta'<=0 | mi(`delta')) {
di as error "A problem has occured with determining delta. Please specify it explicitly."
error 198
}
if (`debugging') noi di "#1"
gen `K' = (`t'-`ei'+`shift')/`delta' if `touse'
cap assert mi(`K') | mod(`K',1)==0
if (_rc!=0) {
di as error "There are non-integer values of the number of periods since treatment. Please check the time dimension of your data."
error 198
}
gen `D' = (`K'>=0 & !mi(`K')) if `touse'
if ("`avgeffectsby'"=="") local avgeffectsby = "`ei' `t'"
if ("`cluster'"=="") local cluster = "`i'"
if ("`autosample'"!="" & "`sum'"!="") {
di as error "Autosample cannot be combined with sum. Please specify the sample explicitly"
error 184
}
if ("`autosample'"!="" & "`hbalance'"!="") {
di as error "Autosample cannot be combined with hbalance. Please specify the sample explicitly"
error 184
}
if (`debugging') noi di "#2 `fe'"
local wtr_count : word count `wtr'
if (`wtr_count'==0) {
tempvar wtr
gen `wtr' = 1 if (`touse') & (`D'==1)
local wtrnames tau
local wtr_count = 1
}
else {
if (`wtr_count'==1) local wtrnames tau
else local wtrnames ""
local wtr_new_list
foreach v of local wtr {
tempvar `v'_new
gen ``v'_new' = `v' if `touse'
local wtr_new_list `wtr_new_list' ``v'_new'
if (`wtr_count'>1) local wtrnames `wtrnames' tau_`v'
}
local wtr `wtr_new_list'
}
if (("`horizons'"!="" | "`allhorizons'"!="") & `wtr_count'>1) {
di as error "Options horizons and allhorizons cannot be combined with multiple wtr variables"
error 184
}
if ("`allhorizons'"!="") {
if ("`horizons'"!="") {
di as error "Options horizons and allhorizons cannot be combined"
error 184
}
if ("`hbalance'"!="") di as error "Warning: combining hbalance with allhorizons may lead to very restricted samples. Consider specifying a smaller subset of horizons."
levelsof `K' if `touse' & `D'==1 & `wtr'!=0 & !mi(`wtr'), local(horizons)
}
if ("`horizons'"!="") {
if ("`hbalance'"=="hbalance") {
tempvar in_horizons num_horizons_by_i min_weight_by_i max_weight_by_i
local n_horizons = 0
gen `in_horizons'=0 if `touse'
foreach h of numlist `horizons' {
replace `in_horizons'=1 if (`K'==`h') & `touse'
local ++n_horizons
}
egen `num_horizons_by_i' = sum(`in_horizons') if `in_horizons'==1, by(`i')
replace `wtr' = 0 if `touse' & (`in_horizons'==0 | (`num_horizons_by_i'<`n_horizons'))
egen `min_weight_by_i' = min(`wtr'*`wei') if `touse' & `in_horizons'==1 & (`num_horizons_by_i'==`n_horizons'), by(`i')
egen `max_weight_by_i' = max(`wtr'*`wei') if `touse' & `in_horizons'==1 & (`num_horizons_by_i'==`n_horizons'), by(`i')
cap assert `max_weight_by_i'<=1.000001*`min_weight_by_i' if `touse' & `in_horizons'==1 & (`num_horizons_by_i'==`n_horizons')
if (_rc>0) {
di as error "Weights must be identical across periods for units in the balanced sample"
error 498
}
drop `in_horizons' `num_horizons_by_i' `min_weight_by_i' `max_weight_by_i'
}
foreach h of numlist `horizons' {
tempvar wtr`h'
gen `wtr`h'' = `wtr' * (`K'==`h')
local horlist `horlist' `wtr`h''
local hornameslist `hornameslist' tau`h'
}
local wtr `horlist'
local wtrnames `hornameslist'
}
if (`debugging') noi di "List: `wtr'"
if (`debugging') noi di "Namelist: `wtrnames'"
if ("`sum'"=="") {
foreach v of local wtr {
cap assert `v'>=0 if (`touse') & (`D'==1)
if (_rc!=0) {
di as error "Negative wtr weights are only allowed if the sum option is specified"
error 9
}
sum `v' `weiexp' if (`touse') & (`D'==1)
replace `v' = `v'/r(sum)
}
}
local tau_num : word count `wtr'
local ctrl_num : word count `controls'
if (`debugging') noi di `tau_num'
if (`debugging') noi di `"`wtr' | `wtrnames' | `controls'"'
tempname b Nt
matrix `b' = J(1,`tau_num'+`pretrends'+`ctrl_num',.)
matrix `Nt' = J(1,`tau_num',.)
if (`debugging') noi di "#4.0"
if ("`unitcontrols'"!="") local fe_i `i'##c.(`unitcontrols')
if ("`timecontrols'"!="") local fe_t `t'##c.(`timecontrols')
count if (`D'==0) & (`touse')
if (r(N)==0) {
if (`shift'==0) noi di as error "There are no untreated observations, i.e. those with `t'<`ei' or mi(`ei')."
else noi di as error "There are no untreated observations, i.e. those with `t'<`ei'-`shift' or mi(`ei')."
noi di as error "Please double-check the period & event time variables."
noi di
error 459
}
tempvar imput_resid
if (`debugging') noi di "#4: reghdfe `Y' `controls' if (`D'==0) & (`touse') `weiexp', a(`fe_i' `fe_t' `fe', savefe) nocon keepsing resid(`imput_resid') cluster(`cluster')"
if (`debugging') noi reghdfe `Y' `controls' if (`D'==0) & (`touse') `weiexp', a(`fe_i' `fe_t' `fe', savefe) nocon keepsing resid(`imput_resid') cluster(`cluster')
else reghdfe `Y' `controls' if (`D'==0) & (`touse') `weiexp', a(`fe_i' `fe_t' `fe', savefe) nocon keepsing resid(`imput_resid') cluster(`cluster')verbose(-1)
local dof_adj = (e(N)-1)/(e(N)-e(df_m)-e(df_a)) * (e(N_clust)/(e(N_clust)-1))
if (`debugging') noi di "#5"
tempvar Y0
gen `Y0' = 0 if `touse'
local feset = 1
if ("`unitcontrols'"!="") {
recover __hdfe`feset'__*, from(`i')
replace `Y0' = `Y0' + __hdfe`feset'__ if `touse'
local j=1
foreach v of local unitcontrols {
replace `Y0' = `Y0'+__hdfe`feset'__Slope`j'*`v' if `touse'
local ++j
}
local ++feset
}
if ("`timecontrols'"!="") {
recover __hdfe`feset'__*, from(`t')
replace `Y0' = `Y0' + __hdfe`feset'__ if `touse'
local j=1
foreach v of local timecontrols {
replace `Y0' = `Y0'+__hdfe`feset'__Slope`j'*`v' if `touse'
local ++j
}
local ++feset
}
forvalues feindex = 1/`fecount' {
recover __hdfe`feset'__, from(`fe`feindex'')
replace `Y0' = `Y0' + __hdfe`feset'__ if `touse'
local ++feset
}
foreach v of local controls {
replace `Y0' = `Y0'+_b[`v']*`v' if `touse'
}
if (`debugging') noi di "#7"
if ("`saveestimates'"=="") tempvar effect
else {
local effect `saveestimates'
cap confirm var `effect', exact
if (_rc==0) drop `effect'
}
gen `effect' = `Y' - `Y0' if (`D'==1) & (`touse')
drop __hdfe*
if (`debugging') noi di "#8"
if (`ctrl_num'>0) {
forvalues h = 1/`ctrl_num' {
local ctrl_current : word `h' of `controls'
matrix `b'[1,`tau_num'+`pretrends'+`h'] = _b[`ctrl_current']
local ctrlb`h' = _b[`ctrl_current']
local ctrlse`h' = _se[`ctrl_current']
}
local ctrl_df = e(df_r)
if (`debugging') noi di "#4B"
local list_ctrl_weps
if ("`se'"!="nose") {
if (`debugging') noi di "#4C3"
local ctrlvars ""
forvalues h = 1/`ctrl_num' {
local ctrl_current : word `h' of `controls'
if (`ctrlb`h''!=0 | `ctrlse`h''!=0) local ctrlvars `ctrlvars' `ctrl_current'
}
if (`debugging') noi di "#4C4 `ctrlvars'"
tempvar ctrlweight ctrlweight_product
forvalues h = 1/`ctrl_num' {
if (`debugging') noi di "#4D `h'"
tempvar ctrleps_w`h'
if (`ctrlb`h''==0 & `ctrlse`h''==0) gen `ctrleps_w`h'' = 0
else {
local ctrl_current : word `h' of `controls'
local rhsvars = subinstr(" `ctrlvars' "," `ctrl_current' "," ",.)
reghdfe `ctrl_current' `rhsvars' `weiexp' if `touse' & `D'==0, a(`fe_i' `fe_t' `fe') cluster(`cluster') resid(`ctrlweight')
replace `ctrlweight' = `ctrlweight' * `wei'
gen `ctrlweight_product' = `ctrlweight' * `ctrl_current'
sum `ctrlweight_product' if `touse' & `D'==0
replace `ctrlweight' = `ctrlweight'/r(sum)
egen `ctrleps_w`h'' = total(`ctrlweight' * `imput_resid') if `touse', by(`cluster')
replace `ctrleps_w`h'' = `ctrleps_w`h'' * sqrt(`dof_adj')
drop `ctrlweight' `ctrlweight_product'
}
local list_ctrl_weps `list_ctrl_weps' `ctrleps_w`h''
}
}
if (`debugging') noi di "#4.75 `list_ctrl_weps'"
}
tempvar need_imputation
gen byte `need_imputation' = 0
foreach v of local wtr {
replace `need_imputation'=1 if `touse' & `D'==1 & `v'!=0 & !mi(`v')
}
replace `touse' = (`touse') & (`D'==0 | `need_imputation')
count if mi(`effect') & `need_imputation'
if r(N)>0 {
if (`debugging') noi di "#8b `wtr'"
cap drop cannot_impute
gen byte cannot_impute = mi(`effect') & `need_imputation'
count if cannot_impute==1
if ("`autosample'"=="") {
noi di as error "Could not impute FE for " r(N) " observations. Those are saved in the cannot_impute variable. Use the autosample option if you would like those observation
> s to be dropped from the sample automatically."
error 198
}
else {
assert "`sum'"==""
local j = 1
qui foreach v of local wtr {
if (`debugging') noi di "#8d sum `v' `weiexp' if `touse' & `D'==1"
local outputname : word `j' of `wtrnames'
sum `v' `weiexp' if `touse' & `D'==1
if (`debugging') noi di "#8dd " r(sum)
assert abs(r(sum)-1)<10^-5 | abs(r(sum))<10^-5
count if `touse' & `D'==1 & cannot_impute==1 & `v'!=0 & !mi(`v')
local n_cannot_impute = r(N)
if (`n_cannot_impute'>0) {
sum `v' `weiexp' if `touse' & `D'==1 & cannot_impute!=1 & `v'!=0 & !mi(`v')
if (r(N)==0) {
replace `v' = 0 if `touse' & `D'==1
local autosample_drop `autosample_drop' `outputname'
}
else {
replace `v' = `v'/r(sum) if `touse' & `D'==1 & cannot_impute!=1
replace `v' = 0 if cannot_impute==1
local autosample_trim `autosample_trim' `outputname'
}
}
local ++j
}
if (`debugging') noi di "#8e"
replace `touse' = `touse' & cannot_impute!=1
if ("`autosample_drop'"!="") noi di "Warning: suppressing the following coefficients because FE could not be imputed for any units: `autosample_drop'."
if ("`autosample_trim'"!="") noi di "Warning: part of the sample was dropped for the following coefficients because FE could not be imputed: `autosample_trim'."
}
}
if (`debugging') noi di "#8c"
tempvar tnorm
gen `tnorm' = rnormal() if (`touse') & (`D'==0 | `need_imputation')
reghdfe `tnorm' `controls' if (`D'==0) & (`touse'), a(`fe_i' `fe_t' `fe') nocon keepsing verbose(-1)
local df_m_control = e(df_m)
local df_a_control = e(df_a)
reghdfe `tnorm' `controls' , a(`fe_i' `fe_t' `fe') nocon keepsing verbose(-1)
local df_m_full = e(df_m)
local df_a_full = e(df_a)
if (`debugging') noi di "#9 `df_m_control' `df_m_full' `df_a_control' `df_a_full'"
if (`df_m_control'<`df_m_full') {
di as error "Could not run imputation for some observations because some controls are collinear in the D==0 subsample but not in the full sample"
if ("`autosample'"!="") di as error "Please note that autosample does not know how to deal with this. Please correct the sample manually"
error 481
}
if (`df_a_control'<`df_a_full') {
di as error "Could not run imputation for some observations because some absorbed variables/FEs are collinear in the D==0 subsample but not in the full sample"
if ("`autosample'"!="") di as error "Please note that autosample does not know how to deal with this. Please correct the sample manually"
error 481
}
local droplist
tempvar abswei
gen `abswei' = .
local j = 1
foreach v of local wtr {
local outputname : word `j' of `wtrnames'
replace `abswei' = abs(`v') if (`touse') & (`D'==1)
sum `abswei' `weiexp'
if (r(sum)!=0) {
replace `abswei' = (`v'*`wei'/r(sum))^2 if (`touse') & (`D'==1)
sum `abswei'
if (r(sum)>1/`minn') {
local droplist `droplist' `outputname'
replace `v' = 0 if `touse'
}
}
else local droplist `droplist' `outputname'
local ++j
}
if ("`droplist'"!="") noi di "WARNING: suppressing the following coefficients from estimation because of insufficient effective sample size: `droplist'. To report them neve
> rtheless, set the minn option to a smaller number or 0, but keep in mind that the estimates may be unreliable and their SE may be downward biased."
if (`debugging') noi di "#9.5"
if (`pretrends'>0) {
tempname pretrendvar
tempvar preresid
forvalues h = 1/`pretrends' {
gen `pretrendvar'`h' = (`K'==-`h') if `touse'
local pretrendvars `pretrendvars' `pretrendvar'`h'
local prenames `prenames' pre`h'
}
if (`debugging') noi di "#9A reghdfe `Y' `controls' `pretrendvars' `weiexp' if `touse' & `D'==0,  a(`fe_i' `fe_t' `fe') cluster(`cluster') resid(`preresid')"
reghdfe `Y' `controls' `pretrendvars' `weiexp' if `touse' & `D'==0, a(`fe_i' `fe_t' `fe') cluster(`cluster') resid(`preresid')
forvalues h = 1/`pretrends' {
matrix `b'[1,`tau_num'+`h'] = _b[`pretrendvar'`h']
local preb`h' = _b[`pretrendvar'`h']
local prese`h' = _se[`pretrendvar'`h']
}
local pre_df = e(df_r)
if (`debugging') noi di "#9B"
local list_pre_weps
if ("`se'"!="nose") {
matrix pre_b = e(b)
if (`debugging') noi di "#9C1"
matrix pre_V = e(V)
if (`debugging') noi di "#9C2"
local dof_adj = (e(N)-1)/(e(N)-e(df_m)-e(df_a)) * (e(N_clust)/(e(N_clust)-1))
if (`debugging') noi di "#9C3"
local pretrendvars ""
forvalues h = 1/`pretrends' {
if (`preb`h''!=0 | `prese`h''!=0) local pretrendvars `pretrendvars' `pretrendvar'`h'
}
if (`debugging') noi di "#9C4 `pretrendvars'"
tempvar preweight
forvalues h = 1/`pretrends' {
if (`debugging') noi di "#9D `h'"
tempvar preeps_w`h'
if (`preb`h''==0 & `prese`h''==0) gen `preeps_w`h'' = 0
else {
local rhsvars = subinstr(" `pretrendvars' "," `pretrendvar'`h' "," ",.)
reghdfe `pretrendvar'`h' `controls' `rhsvars' `weiexp' if `touse' & `D'==0, a(`fe_i' `fe_t' `fe') cluster(`cluster') resid(`preweight')
replace `preweight' = `preweight' * `wei'
sum `preweight' if `touse' & `D'==0 & `pretrendvar'`h'==1
replace `preweight' = `preweight'/r(sum)
egen `preeps_w`h'' = total(`preweight' * `preresid') if `touse', by(`cluster')
replace `preeps_w`h'' = `preeps_w`h'' * sqrt(`dof_adj')
drop `preweight'
}
local list_pre_weps `list_pre_weps' `preeps_w`h''
}
}
if (`debugging') noi di "#9.75"
}
count if `D'==0 & `touse'
local Nc = r(N)
count if `touse'
local Nall = r(N)
tempvar effectsum
gen `effectsum' = .
local j = 1
foreach v of local wtr {
local outputname : word `j' of `wtrnames'
if (`debugging') noi di "Reporting `j' `v' `outputname'"
replace `effectsum' = `effect'*`v'*`wei' if (`D'==1) & (`touse')
sum `effectsum'
matrix `b'[1,`j'] = r(sum)
count if `D'==1 & `touse' & `v'!=0 & !mi(`v')
matrix `Nt'[1,`j'] = r(N)
local ++j
}
if (`debugging') noi di "#10"
if ("`se'"!="nose") {
cap drop __w_*
tempvar tag_clus resid
egen `tag_clus' = tag(`cluster') if `touse'
gen `resid' = `Y' - `Y0' if (`touse') & (`D'==0)
if ("`loadweights'"=="") {
local weightvars = ""
foreach vn of local wtrnames {
local weightvars `weightvars' __w_`vn'
}
if (`debugging') noi di "#11a imputation_weights `i' `t' `D' , touse(`touse') wtr(`wtr') saveweights(`weightvars') wei(`wei') fe(`fe') controls(`controls') unitcontrols(`un
> itcontrols') timecontrols(`timecontrols') tol(`tol') maxit(`maxit')"
noi imputation_weights `i' `t' `D', touse(`touse') wtr(`wtr') saveweights(`weightvars') wei(`wei') fe(`fe') controls(`controls') unitcontrols(`unitcontrols') timecontrols(`
> timecontrols') tol(`tol') maxit(`maxit') `verbose'
local Niter = r(iter)
}
else {
local weightvars `loadweights'
}
local list_weps = ""
local j = 1
foreach v of local wtr {
if (`debugging') noi di "#11b `v'"
local weightvar : word `j' of `weightvars'
tempvar clusterweight smartweight smartdenom avgtau eps_w`j'
egen `clusterweight' = total(`wei'*`v') if `touse' & (`D'==1), by(`cluster' `avgeffectsby')
egen `smartdenom' = total(`clusterweight' * `wei' * `v') if `touse' & (`D'==1), by(`avgeffectsby')
gen `smartweight' = `clusterweight' * `wei' * `v' / `smartdenom' if `touse' & (`D'==1)
replace `smartweight' = 0 if mi(`smartweight') & `touse' & (`D'==1)
egen `avgtau' = sum(`effect'*`smartweight') if (`touse') & (`D'==1), by(`avgeffectsby')
replace `resid' = `effect'-`avgtau' if (`touse') & (`D'==1)
if ("`leaveout'"!="") {
if (`debugging') noi di "#11LO"
count if `smartdenom'>0 & ((`clusterweight'^2)/`smartdenom'>0.99999) & (`touse') & (`D'==1)
if (r(N)>0) {
local outputname : word `j' of `wtrnames'
di as error `"Cannot compute leave-out standard errors because of "' r(N) `" observations for coefficient "`outputname'""'
di as error "This most likely happened because there are cohorts with only one unit or cluster (and the default value for avgeffectsby  is used)."
di as error "Consider using the avgeffectsby option with broader observation groups. Do not address this problem by using non-leave-out standard errors, as they may be down
> ward biased for the same reason."
error 498
}
replace `resid' = `resid' * `smartdenom' / (`smartdenom'-(`clusterweight'^2)) if (`touse') & (`D'==1)
}
egen `eps_w`j'' = sum(`wei'*`weightvar'*`resid') if `touse', by(`cluster')
local list_weps `list_weps' `eps_w`j''
drop `clusterweight' `smartweight' `smartdenom' `avgtau'
local ++j
}
if (`debugging') noi di "11c"
tempname V
if (`debugging') noi di "11d `list_weps' | `list_pre_weps' | `list_ctrl_weps'"
matrix accum `V' = `list_weps' `list_pre_weps' `list_ctrl_weps' if `tag_clus', nocon
if (`debugging') noi di "11e `wtrnames' | `prenames' | `controls'"
matrix rownames `V' = `wtrnames' `prenames' `controls'
matrix colnames `V' = `wtrnames' `prenames' `controls'
if ("`saveweights'"=="" & "`loadweights'"=="") drop __w_*
}
if (`debugging') noi di "#12"
matrix colnames `b' = `wtrnames' `prenames' `controls'
matrix colnames `Nt' = `wtrnames'
ereturn post `b' `V', esample(`touse') depname(`Y') obs(`Nall')
ereturn matrix Nt = `Nt'
ereturn scalar Nc = `Nc'
ereturn local depvar `Y'
ereturn local cmd did_imputation
ereturn local droplist `droplist'
ereturn local autosample_drop `autosample_drop'
ereturn local autosample_trim `autosample_trim'
if ("`Niter'"!="") ereturn scalar Niter = `Niter'
if (`pretrends'>0 & "`se'"!="nose") {
test `prenames', df(`pre_df')
ereturn scalar pre_F = r(F)
ereturn scalar pre_p = r(p)
ereturn scalar pre_df = `pre_df'
}
}
------------------------------------------------------------------------------------------------------------------------------------------------------- end did_imputation ---
r(123);
.   error 123
invalid numlist has too many elements
r(123);

暗示你可能要求太多了。如果不访问您的数据,就没有什么有用的东西可以说了。但

set trace on 
set tracedepth 1 

在运行命令之前可以指示错误发生的位置。如果有必要,将tracedepth调高到2,3,等等。

did_imputation的帮助文件表明这个包有两个依赖项:ftoolsreghdfe。你确认两个都安装好了吗?

ssc install ftools
ssc install reghdfe

最新更新