I have 10 dependant variables, y1-y30, and its respective lagged variables, lagy1-lagy30. I would like to regress one dependant variable on its specific lag variable and five other fixed controls, e.g. regress y1 lagy1 x1-x5. How can I write a loop code to run the 30 regressions and store the estimates respectively?
Currently, I wrote the following code, and the problems are 1) there are some meaningless regressions, e.g. regress y1 lagy2 x1-x5; 2) the estimates could not be stored.
local dependant y1-y10
local independant lagy1-lagy10
local x = 1
foreach p of local dependant{
foreach q of local independant{
regress `p' x1 x2 x3 x4 x5 `q'
est sto m_`x'
local x = `x' + 1
}
}
This is the first time I write loop code in STATA, and I checked previous posts but still could not find a solution. I really appreciate any help or comments. Thank you very much for the time and considerations!
Related Posts with Writing loop for multiple regressions
Replace observations with another group in Panel dataHi, I have panel data and I want to replace observations of one group with the same variable's obser…
creating loopHi, I am new in stata, so I am doing long commands for a simple variable generating. I want to short…
Calculate volatility of daily returns by use of GARCHHi, We try to calculate the forecasted implied volatility of daily returns by use of the GARCH (1,1…
Using loops to create local from other localsI tell Stata that: Code: local 1 "a b c" local 2 "d e f" local 3 "g h i" and I want it to create t…
Interpreting significance - HLM using REML and Kenward-Roger-corr.Dear Statalisters, I struggle with interpreting my results from multilevel linear regressions, usin…
Subscribe to:
Post Comments (Atom)
0 Response to Writing loop for multiple regressions
Post a Comment