I'm working with a code (from a published paper) and it defines the following program:
Code:
program drop myqreg
program myqreg
version 10.1
syntax [varlist] [if] [in] [, *]
if replay() {
_coef_table, `options'
exit
}
qreg `0'
end
and later on calls it in the following code:
Code:
forvalues i = 1/100{
myqreg y x1 x2 x3 x4 x5 x6 x7 x8 if state==`i'
matrix define beta_`i' = e(b)
foreach n of numlist 1/5 {
local b`n'_`i' = beta_`i'[1,`n']
replace b`n' = `b`n'_`i'' if state == `i'
}
display "`i'"
}
Question: why define the program myqreg? Is it achieving anything more than simply running the following code which explicitly has a qreg command in it (without the need for writing myqreg)?
Code:
forvalues i = 1/100{
qreg y x1 x2 x3 x4 x5 x6 x7 x8 if state==`i'
matrix define beta_`i' = e(b)
foreach n of numlist 1/5 {
local b`n'_`i' = beta_`i'[1,`n']
replace b`n' = `b`n'_`i'' if state == `i'
}
display "`i'"
}
Also, x6, x7, and x8 are dummy variables that are perfectly collinear (in that sense the command is a bit superfluous). The only difference I notice of using myqreg instead of qreg is that in the former case, the coefficient table does not report results for variables that are omitted. It'll be great if someone can explain which snippets of the myqreg are achieving this.
Thanks.
Girish
0 Response to myqreg vs qreg
Post a Comment