Hello Victor,
When you're working with an ARX (AutoRegressive with eXogenous inputs) model, the requirement for the exogenous input X to have at least 365 observations is likely due to the way ARX models handle lagged variables and align data.Understanding the Requirement
- ARX Model Structure:
- An ARX model uses past values of the dependent variable (AR part) and current/past values of exogenous variables (X part) to predict the current value of the dependent variable.
- If your ARX model is of order 1 (ARX1), it means it uses one lag of the dependent variable.
2. Data Alignment:
- When you fit an ARX model, the lagged dependent variable and the exogenous variable X need to be aligned correctly.
- For 364 observations of your dependent variable, you'll need 365 observations of X to cover the initial period before the first observation of the dependent variable is used.
Adding an Initial Observation to X
Given that your data starts on a Monday, your X should ideally start with a 0 to maintain the alignment where 0 corresponds to weekdays and 1 to weekends. Here's why:
- Initial Day (X0): Since your data starts on a Monday, the first observation of X should be 0, aligning with a weekday.
- Weekly Pattern: By starting with a 0, your weekly pattern [0 0 0 0 0 1 1] will correctly represent the weekdays and weekends throughout the dataset.
% Initial X with 364 observations
X = repmat([0 0 0 0 0 1 1]', 52, 1);
% Add an initial 0 for the first Monday
X = [0; X];
I hope it helps!