I'm attempting to find the root of a non-linear equation using mata. Running Stata 15.1 on MacOS Mojave 10.14.6. Here is my code:
mata
maxu = 2.63506
u3 = 836.8054
u4 = 117.3982
u2 = 4.283902
w = 60.069
function myfunc(x, maxu, u3, u4, u2, w) return(maxu - ln(u3+u4+u2*exp(.0175134(w-x))))
rc = mm_root(x=., &myfunc(), 0, 1, 0 , 1000, maxu, u3, u4, u2, w)
x
end
This is the error message I'm getting:
: function myfunc(x, maxu, u3, u4, u2, w) return(maxu - ln(u3+u4+u2*exp(.0175134(w-x))))
invalid expression
r(3000);
Any suggestions? Thanks.
Related Posts with Problem with function definition for mm_root
Estimation of the same survival models converges sometimes and sometimes doesn'tI estimate survival models. However, the model converges sometimes and sometimes it doesn't even tho…
Gravity model estimation using PPML with fixed effectsHello All, I'm trying to estimate GVC trade flows in a gravity model, using the PPML method. My dep…
Cluster by firmHi- does clustering by firm has any impact on coefficient (or on Constant)? I read it reduces coeffi…
Saving first-stage F-statistic with -ivprobit, twostep-I am running -ivprobit, twostep first- and want to capture the first-stage F-statistic. The e(return…
Instrument set from initial period regressionHi I am running af 2sls model with panel data where I on average have 6 observation for each indivi…
Subscribe to:
Post Comments (Atom)
0 Response to Problem with function definition for mm_root
Post a Comment