As a beginner, i would like to ask if Julia provides any package (or function) for black box polynomial model estimation (preferably VARX model) and anaylis.

Hello and welcome to the community

What kind of data are you modelling? Would a statespace model on the form

work? This kind of model can be easily converted to an multivariate ARX model after estimation if required.

what kind of analysis are you interested in performing? There are a few model-validation methods implemented in ControlSystemIdentification.jl, but they don’t really target the time-series usecase as much as they do the system-identification use case. See also this post for several packages targeting time-series use cases.

Hello @baggepinnen ,

Thank you for your reply. I have seen your effort and it is very impressive. Basically, I have been reading the documentation of Julia for a while, and that of your package. I have a good background in programming, but i am new to the ‘logic’ of Julia in comparison with other programming languages.

I am conducting research for Structural Health Monitoring of a Ship Structure. And VARX as model is proper for the modelling stage (at least by using MATLAB and R sometimes).

I have been using MATLAB many years, but i understand why people search for alternatives.

I have knowledge of the domain. So, if you want, i can help (under your guidance) in your effort to enrich the package with time-series/polynomial models and more.

Thank you again for your time!

ControlSystemIdentification.jl already supports estimating some form of polynomial models, like ARMAX and ARX models with multiple inputs. Part of the reason I have had very little focus on poynomial models, like VARX etc. is that they are special cases of a general linear model. A VARX(p) model of any order p can be equivalently reformulated as a VARX(1) model, which is a linear state-space model, so with support for the estimation of MIMO state-space models you can technically estimate VARX models as well.

If you can convince me that adding support for the estimation of these models contributes something that the existing methods do not handle, I’d be happy to include such functionality, at least for time-series models that come with the X-suffix for external inputs (like VARX), since this is a fundamental aspect of control systems.

I see your point and i agree.

The only point that is good to include VARX models, is to cover the users that may not have deep knowlgedge of state space models. Or in some cases, someone may need to alternate the least squares criterion (rigde regression, for example). In the aspect of control system, i can only think of these right now.

But if someone is using system identification for Structural Healthm Monitoring, then someone can enrich these models for Environmental and Operating Conditions (EOCs) & uncertainty scenarios. Or many other aspects.

I will stay to these. Is of course your choice what to do, and i know that you may value your time.

Thank you!

How are you using these model after they have been identified? Do you use them for simulation, frequency-domain analysis, anything else?

One method is to use machine learning algorithms, and utilize for example the parameter vector in order to compare the different states of a structure / system (Healthy / Faulty). Thus the parameter vector can be used as a feature for the machine learning aspect.

These are some examples. As feature you can use and quantities from frequency domain, like Power Spectral Density.

But if your goal is to stay in the boarders of Control aspect, i understand.

This could be done for any model estimated, linear or otherwise? It does not have to have the special VARX structure?

I don’t want to prevent you from using these models if those are what you are familiar with, but I cannot see the benefit of using them over something strictly more general.

For

you could actually construct a “VARX” function that just estimates a more general model under the hood and then converts it to the VARX structure.

Here’s a script that simulates a VARX(2,1) model and then estimates a standard linear statespace model using two different approaches. The fit is close to 100%

```
using ControlSystemIdentification, Plots
A1 = 0.3randn(2,2) # True VARX parameters
A2 = 0.3randn(2,2)
B1 = randn(2,2)
N = 300 # Number of time steps to simulate
Y = [randn(2), randn(2)]
u = randn(2, N)
for i = 3:N
yi = A1*Y[i-1] + A2*Y[i-2] + B1*u[:,i-1]
push!(Y, yi)
end
y = hcat(Y...)
d = iddata(y, u, 1)
model = subspaceid(d, 4) # Estimate using subspace-based identification
model2, _ = newpem(d, 4) # Estimate using the prediction-error method
simplot(d, model, title="Simulation performance subspaceid")
simplot(d, model2, title="Simulation performance PEM")
```

These coefficients could be used as your features for the machine-learning classifier

Alternatively, if you want a minimal set of parameters, convert to a polynomial model (transfer function) and extract those coefficients instead:

```
julia> numvec(tf(model2))
2×2 Matrix{Vector{Float64}}:
[1.64374, 0.744194, 0.728624, -0.117102] [-0.0783438, 0.174749, 0.0175149, -0.0055857]
[-0.0929754, 0.813401, -1.1772, 0.146595] [-1.22746, -0.271548, -0.0117105, 0.0069934]
julia> denvec(tf(model2))
2×2 Matrix{Vector{Float64}}:
[1.0, 0.768187, 0.770503, 0.0302766, -0.00970963] [1.0, 0.768187, 0.770503, 0.0302766, -0.00970963]
```

@baggepinnen Thank you very much.

I think that the solution that you provide will work. I will check it!