Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: How can we incorporate COVARIATES into a NL evaluator program


From   Quang Nguyen <[email protected]>
To   [email protected]
Subject   st: How can we incorporate COVARIATES into a NL evaluator program
Date   Wed, 15 Apr 2009 00:22:14 -1000

Dear All:

Follwing is an example from Stata website regarding the NL program
evaluator for the CES:


            ln Q = b0 - 1/rho*ln{delta*K^-rho + (1-delta)*L^-rho}

        where Q denotes output and b0, rho, and delta are parameters
to be estimated.


Now, suppose delta correlate with education as such: delta = delta_0 +
b*Edu. Using nl we can estimate delta_0 and b as follows:

nl ( ln Q = {b0} - 1/{rho}*ln({delta_0}+{b}*edu)*K^-{rho} +
(1-{delta_0}+{b}*edu))*L^-{rho})


My question is how we can estimate delta_0 and b if we write a program
evaluator. FYI, here is the program evaluator from Stata website:


            program nlces
                version 10
                syntax varlist(min=3 max=3) [aw fw iw] if, at(name)
                local logout: word 1 of `varlist'
                local capital: word 2 of `varlist'
                local labor: word 3 of `varlist'
                // Retrieve parameters out of at matrix
                tempname b0 rho delta
                scalar `b0' = `at'[1,1]
                scalar `rho' = `at'[1,2]
                scalar `delta' = `at'[1,3]
                // Some temporary variables
                tempvar kterm lterm
                generate double `kterm' = `delta'*`capital'^(-1*`rho') `if'
                generate double `lterm' = (1-`delta')*`labor'^(-1*`rho') `if'
                // Now fill in dependent variable
                replace `logout' = `b0' - 1/`rho'*ln(`kterm'+`lterm') `if'
            end






-- 
"My father gave me the greatest gift anyone could give another person,
he believed in me." - Jim Valvano
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index