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
Mundlak procedureDear all, When using the Mundlak procedure, if one wishes to include year fixed effects (i.e. a dum…
How to rewrite graph-like command that written by users under Stata 6.0 or earlierDear Stata users, Stata had changed its graph command since version 7. However there are a lot of c…
From single event observations to time seriesHi everyone, As I am quite new to Stata hope you can help me out with the next question. Currently…
error message returned when installing spost13 using Stata 17Hello, I would like to use Brant test for my ordered logistic regression models and tried to instal…
Time and Country Fixed Effects in Panel Data Estimation (OLS and PPMLI am doing a regression taking 34 countries for the time period 2010-19. It is a gravity model so th…
Subscribe to:
Post Comments (Atom)
0 Response to Problem with function definition for mm_root
Post a Comment