Dear all,
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')
}
end
It seems to me that using locals is more efficient because we do not create additional variables, but im not sure how accurate are some equations when trying to put together long equations just using locals.
My 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.