# Is a way to use differential equation as multiple variable function for regression?

I have a function: dx/dt = f(x, y) = (p1 + y) * x + p2 * sqrt(x)

where p1, p2 - parameter for optimization

Is a way to make solution like sol(t, y) for nonlinear model fitting? Can it be done with DifferentialEquations.jl?

Yes, it is possible to do parameter estimation using the DifferentialEquations.jl ecosystem. The docs describe how you can build an objective function from a DifferentialEquations.jl `DEProblem` that you can then pass to an optimization algorithm to do the fitting.

1 Like

Thank you! I noticed this method and it excelent works for parameters optimization when i have one dependent and one predictor (and any count of parameters) f(x, (p1, p2…pn)), but i have two predictors f(x,y, (p1, p2…pn)). Does it means that for each observation i have to build separate problem? And then optimize it?

Do a system of ODEs?

What is `y`? Do you have a differential equation for `y`, too? If yes, then you have a system of 2 differential equations.

Next, do you have observations? Do you have observations of `x`, or `y`, or both?

I have data like this (many observations):

``````time  y   x
1     0  0.2
1     1  0.6
2     0  1.7
2     1  2.3
...
``````

where dx/dt = (p1 + y) * x + p2 * sqrt(x)

and i have to find p1 and p2