Fit an MA model onto a given data set

5 views (last 30 days)
Mitul Dattani
Mitul Dattani on 18 Nov 2019
Hi, I need to add an MA(6) model onto a set of data (which is attached).
So far I have plotted the time series, plotted the auto correlation and partial autocorrelation functions, then determined that an MA model would be better suited than an AR, as the partial autocorrelation function was geometric, and the autocorrelation function had 6 significant lag points, and tended towards 0.
I was also unsure at the start when deducing whether or not the model was AR or MA hence why i differenced X to allow for a pattern to be identified.
Im struggling to fit the data onto the MA(6) model.
Any help is much appreciated!
The code I have so far is:
%% 1 (Load and Plot data from the X6 file)
load('X6.mat');
X=X6;
figure(1);plot(X);
%% 2 (Plot autocorrelation and partial autocorrelation)
% figure(2); plot(diff(X)) % Variance not constant therefore plot difference
% figure(3); autocorr(diff(X))
% figure(4); parcorr(diff(X)) % Partial Autocorrelation function geometric, thus MA process
figure(2); autocorr(X)
figure(3); parcorr(X) %MA(6) process
%% 3 (Fit the data to an MA model)
MA6=arima(0,0,6);
MA6.Constant=0;
MA6.Variance=1;
x=simulate(MA6,5000);
autocorr(x)

Answers (0)

Community Treasure Hunt

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

Start Hunting!