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
Using (nested) loops to conditionally sumHello, thank you in advance for any advice you are able to provide me with. I am a rather novice whe…
area specific linear time trendI have 2012-2018(Aug) monthly data, there are 80 (6*12+8) time periods. 52 areas in the data set I …
how to investigate whether the values of a variable in a group are the sameI have an unbalanced panel data about mutual funds. The variables are listed below: yrm: the date va…
-xtdpdml-, -xtabond- or -cmp-?Hi All: I want to investigate the causality relationship between work and health. My model is like …
How to use OLS to estimate a rough ATE (Average Treatment Effect)?Hi, I am using traditional NSW(National Supported Work Demonstration) dataset to do couple of match…
Subscribe to:
Post Comments (Atom)
0 Response to Problem with function definition for mm_root
Post a Comment