Setting specific lags
Contents
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.model_structure_selection import FROLS
from sysidentpy.basis_function._basis_function import Polynomial
from sysidentpy.metrics import root_relative_squared_error
from sysidentpy.utils.generate_data import get_siso_data
from sysidentpy.utils.display_results import results
from sysidentpy.utils.plotting import plot_residues_correlation, plot_results
from sysidentpy.residues.residues_correlation import compute_residues_autocorrelation, compute_cross_correlation
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}\)
basis_function = Polynomial(degree=1)
model = FROLS(
order_selection=True,
extended_least_squares=False,
ylag=4, xlag=4,
info_criteria='aic',
estimator='least_squares',
basis_function=basis_function
)
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 = FROLS(
order_selection=True,
extended_least_squares=False,
ylag=[1, 4], xlag=[1, 4],
info_criteria='aic',
estimator='least_squares',
basis_function=basis_function
)