I have a general question regarding the use of locals vs actually creating temporary variables when using ML estimator
Suppose Im estimating a simple OLS using -ml- with -lf- method.
This is a simple task as I can do one of the following:
Code:
program myols1,
args lnf xb lns
qui {
tempvar sigma
gen double `sigma'=exp(`lns')
replace `lnf'=log(normalden($ML_y1,`xb',`sigma')
}
end
** vs
program myols1,
args lnf xb lns
qui {
local sigma exp(`lns')
replace `lnf'=log(normalden($ML_y1,`xb',`sigma')
}
endMy question is, is there any advantage or disadvantage of using locals rather than creating the temporary variables when using ML?
Thank you in advance.
Fernando
PS. the ML objective function I'm working with is a more complex that the one in the example.
0 Response to Locals vs variables: ML estimator
Post a Comment