Linear regression with stochastic regressors

I am trying to learn PyMC by starting off with a simple parameter identification using linear regression. I have a very simple mass-spring-damper model which I integrate numerically to get the displacement, velocity, acceleration and applied force as a function of time (I add noise to simulate measurement error).

My question: Is it possible to set up a PyMC model to identify the stiffness, damping and mass of the system form these noisy time series? (The displacement, velocity and acceleration time series form the regressor matrix, the force time series forms the observed vector, and the unknown parameters are the regression coefficients).

Any suggestions on how to go about solving this problem via PyMC would be greatly appreciated!

Hi and welcome @joshu3a !

There is certainly a way to model this, though I am (unfortunately) too far from the basic physics of oscillators to spin up the code.
Generally, if it is just about regression, the following example used to help me personally:
https://docs.pymc.io/en/v3/pymc-examples/examples/generalized_linear_models/GLM-robust.html

… unfortunately it is not up to date. But there might be other useful traces in the v4 examples.

Generally, I find probabilistic models very useful to estimate parameters underlying noisy data, in very simple models. I have a simple measurement documented here, but that was also quite a long time ago :slight_smile:

Hope this helps!

Here’s the updated version of the robust GLM notebook. You can find all the v4 example notebooks here.

1 Like

thanks @jessegrabowski I overlooked that (and am now reminded that I shouldn’t trust on google search results)
Cheers!

Yeah the search engine indexing for any specific example notebooks seems like a big mess. It’s best to just look up the example gallery first, then look for what you want from there.

1 Like