Length of X in in ARX/ARMAX/ARIMAX

1 回表示 (過去 30 日間)
Victor
Victor 2014 年 11 月 24 日
回答済み: prabhat kumar sharma 2025 年 1 月 10 日
Hi,
I want to an ARX1 model where X is an Indicator function which is 1 during weekends and 0 during weekdays. I have daily data starting on a Monday from January 2 until December 31 (364 obs). I created my X as follows:
X = repmat([0 0 0 0 0 1 1]', 52, 1);
Hence X has also 364 obs. However when I now estimate my model I get an error saying that X must contact at least 365 obs.
I know this has something to do with a X0, however I am not sure what this X0 should be (to be honest I'm not really sure why I need X0). Adding a single 0 or 1 at the beginning of my X does the trick but can someone please tell me whether this should be a 0 or a 1 (even though results are almost the same) and whether my AR1 and X will still be correctly 'aligned' after adding a single observation at the beginning of my X. That is, will all '1's be corresponding to weekends and '0's to weekdays.
Thank you!

回答 (1 件)

prabhat kumar sharma
prabhat kumar sharma 2025 年 1 月 10 日
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
  1. 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!

カテゴリ

Help Center および File ExchangeNonlinear ARX Models についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by