Loading excel data for VAR model
조회 수: 3 (최근 30일)
이전 댓글 표시
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
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Vector Error-Correction Models에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!