[英]Stata Loop for lagged variable
i want to regress two variables r and in .我想回归两个变量r和. But i want to test multiple lags for the variable in and check which lag delivers the best fit for Rsquared.但我想测试变量in的多个滞后,并检查哪个滞后最适合 Rsquared。
I want to test -3,-2,-1,0,1,2,3我想测试-3,-2,-1,0,1,2,3
regress r l.in
regress r l2.in
regress r l3.in
(.....)
Is it possible to do this using a loop?是否可以使用循环来做到这一点?
forval k = 1/7 {
regress r l`k'.in
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.