【问题标题】:Stata -- Durbin Watson statistic by company id in a large datasetStata——在大型数据集中按公司 ID 进行的 Durbin Watson 统计
【发布时间】:2014-08-26 15:40:00
【问题描述】:

我正在尝试通过 company_id 使用大型数据集在 Stata 中运行回归。目标是为每个company_id 生成一条线,其中包含回归结果。我正在使用以下代码,它为我提供了 beta 系数、std 误差、adj r-squared 和 N。但我还需要包括 Durbin Watson 统计数据,并且到目前为止还没有成功。有人可以帮忙吗?谢谢。

statsby _b _se r2 = e(r2_a) _N, by (company_id) saving($path\SC_results_`i'.dta, replace): regress ret sptr_ret 

【问题讨论】:

标签: stata


【解决方案1】:

regressdwstat 组合成一个命令的小程序应该会有所帮助。这是一个尝试。

capture program drop reg_dw
program reg_dw, rclass
syntax varlist
regress `varlist'
dwstat
return scalar dw=r(dw)
end

webuse invest2,clear
gen index=_n
tsset index
statsby _b _se r2 = e(r2_a) dw=r(dw) _N, by (company) saving(x.dta, replace): reg_dw invest market
use x, clear
tab _eq2_dw

【讨论】:

    猜你喜欢
    • 2017-09-05
    • 1970-01-01
    • 1970-01-01
    • 2022-09-28
    • 1970-01-01
    • 2015-10-07
    • 1970-01-01
    • 2015-11-14
    • 1970-01-01
    相关资源
    最近更新 更多