# Estimate the relation of parameter to state variable with uncertainty quantification

**URL:** <https://discourse.julialang.org/t/estimate-the-relation-of-parameter-to-state-variable-with-uncertainty-quantification/127450>\
**Category:** Modelling & Simulations\
**Tags:** sciml\
**Created:** [March 28, 2025, 11:35am UTC](https://discourse.julialang.org/t/estimate-the-relation-of-parameter-to-state-variable-with-uncertainty-quantification/127450 "2025-03-28T11:35:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jack\_cooper](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jack_cooper/32/214665_2.png) [@Jack\_cooper](https://discourse.julialang.org/u/Jack_cooper)\
**Post date:** [March 28, 2025, 11:35am UTC](https://discourse.julialang.org/t/estimate-the-relation-of-parameter-to-state-variable-with-uncertainty-quantification/127450/1 "2025-03-28T11:35:44Z")

</div>

Hi, I am new to the SciML ecosystem, and I apologise if my question is too basic. I have a 1D differential equation system, dx/dt = f(x; p), where the parameter p is a function of the state variable. Given data for the state variable, can I use a Universal Differential Equation to estimate the function p(x) with uncertainty quantification? Could I please receive some guidance on the best approaches to do this? Thanks in advance.

---

<div class="post-metadata">

**Author:** ![baggepinnen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/baggepinnen/32/693_2.png) [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)\
**Post date:** [March 28, 2025, 11:52am UTC](https://discourse.julialang.org/t/estimate-the-relation-of-parameter-to-state-variable-with-uncertainty-quantification/127450/2 "2025-03-28T11:52:48Z")

</div>

Hello Jack and welcome to the forum 👋

You say that the parameter p is a function of the state x, p(x), this is slightly non-standard terminology that may be foreign to some, so I’m asking a few questions to clarify things.

- Would it be fair to say that you are trying to estimate f(x) and that you know some aspects of f but not others, e.g., f(x) = g(x) + p(x) where g is known and p is unknown?
- What do you know about p(x)? Do you know some functional form, but are missing the exact values of (static) parameters \theta, e.g., p(x, \theta)?, Or do you know nothing at all?

---

<div class="post-metadata">

**Author:** ![Jack\_cooper](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jack_cooper/32/214665_2.png) [@Jack\_cooper](https://discourse.julialang.org/u/Jack_cooper)\
**Post date:** [March 28, 2025, 4:08pm UTC](https://discourse.julialang.org/t/estimate-the-relation-of-parameter-to-state-variable-with-uncertainty-quantification/127450/3 "2025-03-28T16:08:34Z")

</div>

Hi @baggepinnen, thanks for your reply and apologies for any ambiguity. Here is a clearer plain text version of the problem:

We have a state function f that includes a parameter which is a function of the state variable. For instance, in an RC circuit, the resistance R depends on the temperature T. The system dynamics are described by the following differential equations:

For temperature: dT/dt = -h \* (T - T0) + sin(wt) \* V \* R(T)

For voltage: dV/dt = -[V + sin(wt) \* R(T)] / [R(T) \* C]

Initial conditions: T(0)=T0, and V(0)=0

In these equations, T0, h, w, and C are known scalar constants. We have data for both state variables (temperature and voltage) collected from multiple experiments with different initial conditions. The goal is to estimate the function R(T) from this data and to determine uncertainty bounds for the estimate.

---

<div class="post-metadata">

**Author:** ![baggepinnen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/baggepinnen/32/693_2.png) [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)\
**Post date:** [April 7, 2025, 8:48am UTC](https://discourse.julialang.org/t/estimate-the-relation-of-parameter-to-state-variable-with-uncertainty-quantification/127450/4 "2025-04-07T08:48:05Z")

</div>

Do you have any idea what functional form R(T) might take, e.g.  
R(T) = aT^b  
R(T) = a + bT + cT^2  
etc.?

if you do, you can use the function `nonlinear_pem` from here

> **[Nonlinear identification · ControlSystemIdentification Documentation](https://baggepinnen.github.io/ControlSystemIdentification.jl/dev/nonlinear/)**
>
> Documentation for ControlSystemIdentification Documentation.

and encode your dynamics such that the parameters (a,b,c above) are placed in p and you call R(T, p) from inside your dynamics function. Once the model is estimated, you can obtain the covariance matrix of the estimated parameters using `Σ = inv(model.Λ())` (shown in the example in the link above).
