我正在尝试提高脚本的效率,基本上,我运行了许多线性回归,并且对于每个拟合模型,我将估计的系数和标准误差结果存储在先前创建的数据框中,例如results
.
因此,在存储任何回归系数之前,数据框results
已经具有所需的维度。
此外,对于i
我所做的每一个回归:
mod.fit <- plm(y ~ x1 + x2, index="group", sample)
然后我运行:
results[i,1] <- summary(m.fit)$coefficients[1,1]
results[i,2] <- summary(m.fit)$coefficients[2,1]
results[i,3] <- summary(m.fit)$coefficients[1,2]
results[i,4] <- summary(m.fit)$coefficients[2,2]
有没有办法使上述存储步骤更快?
.