I have a model for which i already have fits in r language. Now i’m implementing same in Julia where i’m not getting any fits. Upon checking different solvers with my posterior from r, I can see none of solvers is giving fit plot that I obtained in r. I can see oscillation in solution. My system is stiff.
It’s not really possible to give specific advise without a more definite problem description, i.e. a complete but minimal working example that exhibits a clear-cut error. Generally speaking, rather than checking the Julia’s output against R’s output, it would be better to find a closely related problem with known closed-form solution, and check whether the Julia solution converges towards the closed-form solution at the expected rate.
no, I mean just call f(u, p, t) with random u and t values (the same random values for Julia and R). The most common reason for this type of error is that you made a typo when porting the function.
Note that you can use deSolve.jl to call exactly the same solvers from R. If they aren’t giving the exact same solution then, you can be certain that your f function is implemented differently.
As @Oscar_Smith said, the first step of debugging a model translation from another language is to run the f call on the same random values in both languages and see that they give exactly the same results. Like 99% of the time someone reports a translation issue, this is the diagnostic that fails and identifies the bug.