Loading excel data for VAR model

3 次查看(过去 30 天)
Manuel Verma
Manuel Verma 2018-2-6
I have data yearly data on four economic variables which I would like to use for building a vector autoregressive model. The data is in an excel file and I am importing it using the 'Import data' button and generating the script:
[~, ~, raw] = xlsread('XYZ.xlsx','Sheet1');
raw = raw(1:48,:);
raw(cellfun(@(x) ~isempty(x) && isnumeric(x) && isnan(x),raw)) = {''};
%%Replace non-numeric cells with NaN
R = cellfun(@(x) ~isnumeric(x) && ~islogical(x),raw); % Find non-numeric cells
raw(R) = {NaN}; % Replace non-numeric cells
%%Create output variable
data = reshape([raw{:}],size(raw));
%%Allocate imported array to column variable names
Year1 = data(:,1);
w_j = data(:,2);
s_j = data(:,3);
alpha_j = data(:,4);
I have read the documentation for the econometrics tookbox (https://uk.mathworks.com/help/econ/fit-a-var-model.html) but when I try
Mdl = varm(2,2)
I get the error
Undefined function or variable 'varm'.
I can plot the variables and perform ADF tests etc.
This is the first time I'm using Matlab so is there anything special I have to do in order to use the econometrics toolbox? I can see that I have it installed but still I get the error. Also, would it be more efficient if I converted the .xlsx file to a .mat file? Any advice is appreciated.

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Vector Error-Correction Models 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by