使用回归变量列表并存储 beta 的值

using a list of regressors and storing the values of betas

我有一份情况和影响清单: 我想生成一个包含 betas 值的 betas 矩阵。我要 运行 循环 10 次,因为实际上我要 bootstrap 我的观察。

到目前为止我已经尝试过:

local circumstances height weight

local effort training diet

foreach i in 1 10 {

    reg outcome  `circumstances' `effects' 

    * store in column i the values of betas of circumstances

    * store in column i the values of betas of effort 

 }

有谁知道存储这些值的代码应该是什么样的? 谢谢

伪代码首先会在 "column 1" 中存储第一批 beta,然后用第二批 beta 覆盖它们(第 1 列)。然后它将对第 10 列再次执行相同的操作,其中包含第一批 beta 和第二批 beta。这与任何有意义的事情都有很长的路要走。您的伪代码中没有任何内容从数据集中获取 bootstrap 个样本,尽管您可能打算稍后为此添加代码。

Stata 并不真正处理列号的任何想法,尽管这个想法对 Mata 有意义。

除非有非常具体的原因——您需要详细说明——没有必要为 bootstrapping 编写自己的代码 ab initio ,因为 bootstrap 的全部意义在于为您做到这一点。

这是 bootstrapping 愚蠢回归的可重现示例的完整代码:

sysuse auto, clear
bootstrap b_weight=_b[weight] b_price=_b[price] , reps(1000) seed(2803) : regress mpg weight price

另请参阅 bootstrap 的帮助以了解其其他选项,包括 saving()

10 次重复对于 bootstrap 个样本的数量来说太少了。