V0.1.6 - Setting specific lags

Example created by Wilson Rocha Lacerda Junior

Different ways to set the maximum lag for input and output

pip install sysidentpy
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sysidentpy.polynomial_basis import PolynomialNarmax

Setting lags using a range of values

If you pass int values for ylag and xlag, the lags are defined as a range from 1-ylag and 1-xlag.

For example: if ylag=4 then the candidate regressors are \(y_{k-1}, y_{k-2}, y_{k-3}, y_{k-4}\)

model = PolynomialNarmax(non_degree=1,
                         order_selection=True,
                         n_info_values=10,
                         extended_least_squares=False,
                         ylag=4, xlag=4,
                         info_criteria='aic',
                         estimator='least_squares',
                         )

model.regressor_code
array([[   0],
       [1001],
       [1002],
       [1003],
       [1004],
       [2001],
       [2002],
       [2003],
       [2004]])

Setting specific lags using lists

If you pass the ylag and xlag as a list, only the lags related to values in the list will be created.

model = PolynomialNarmax(non_degree=1,
                         order_selection=True,
                         n_info_values=10,
                         extended_least_squares=False,
                         ylag=[1, 4], xlag=[1, 4],
                         info_criteria='aic',
                         estimator='least_squares',
                         )

model.regressor_code
array([[   0],
       [1001],
       [1004],
       [2001],
       [2004]])