After reading excel file(of raw data) on matlab, I did makes some transformation on the data.
And in working directory, I get file “data_sample” of 61*44.
data_sample.mat (19.8 KB)
(I saved the file for question)
And “names_to_include” is 1*44 cell which include column name in the working directory.
Now for some columns of the matrix, I want to do seasonal adjustment so I write the code as following.
% Define list of variables to be seasonally adjusted
variables_to_sa={'g_pib','g_pib_x2','g_pib_nt2','g_pib_co','g_cons','g_inv',...
'gov_lt','ppiN2','ppiT2', 'ppiM','ppi_A','ppi_E','ppiWX_cmo', 'ppiWN_cmo',...
'ppi_mstr'};
% Define the X-13ARIMA-SEATS specification
spec1 = makespec('AUTO','PICK','X11','NO OUTLIERS');
% Copy the original data set to a new data set for seasonal adjustment
data_sample_sa=data_sample;
% Iterate through the variables to be seasonally adjusted
for j = 1:length(variables_to_sa)
% Find the position of the variable in the data set
pos_j = find(strcmpi(names_to_include, variables_to_sa{j}));
% Extract the variable from the data set
var_j = data_sample(:, pos_j);
% Convert the variable to a dseries object
var_j_ds = dseries(var_j,'1986Q1', variables_to_sa{j});
% Perform the seasonal adjustment using X-13ARIMA-SEATS
aux_j_sa = x13(var_j_ds, spec1);
% Extract the seasonally adjusted series
var_j_sa = aux_j_sa.e2;
% Replace the original series in the data set with the seasonally adjusted series
data_sample_sa(:, pos_j) = var_j_sa;
end
But I don’t know why but it keep giving me error message “The ‘dseries’ class is used as one of the default class definitions, property values, or attribute values within the class definition. This is not allowed.”
I’ll really appreciate for your help.
Thanks in advance