Displaying 1 result from an estimated 1 matches for "mom_iq".
Did you mean:
dom_id
2012 Jan 13
1
loops over regression models
...now I can use foreach to build a loop to
condense the codes (especially if I have a large number of models to
run).
In Stata, it would be something like:
****************************************************
// read in data
use kidiq, clear
// run two regression
reg kid_score mom_hs
reg kid_score mom_iq
// the next three lines are equivalent of the previous two lines
foreach var in mom_hs mom_iq {
reg kid_score `var'
}
***************************************************
So I want to figure out how to use R to do this. Below are my codes:
###################################################...