Whats wrong in this code? About error code:zeros

% 예시: 그레인저 인과 검정을 위한 코드
% 시계열 데이터가 있는 엑셀 파일 불러오기
data = readtable("Data1.xlsx");
Error using readtable
Unable to find or open 'Data1.xlsx'. Check the path and filename or file permissions.
% 'Date' 열을 datetime 형식으로 변환
data.Date = datetime(data.Date, 'InputFormat', 'yyyy-MM-dd');
% 시계열 데이터 선택 (예시로 여러 변수 사용)
selected_data = data(:, {'Date', 'Price' 'E_Price' 'H_Price' 'L_Price' 'Previous_f' 'Volume'});
% VAR 모델 구축
var_order = 2; % VAR 모델의 차수
data_matrix = table2array(selected_data(:, 2:end));
% 데이터를 행렬 형태로 변환하여 VAR 모델 피팅
num_responses = size(data_matrix, 1);
var_model = varm(num_responses, var_order);
var_fit = estimate(var_model, data_matrix');
% 그레인저 인과 검정 수행
lag_order = 1; % 그레인저 인과 검정의 시차
granger_test_result = grangercausalitytest(data_matrix, lag_order, 'NumLags', var_order);
% 결과 출력
disp('Granger Causality Test Results:');
disp(granger_test_result);

댓글 수: 2

grangercausalitytest() is not part of MATLAB.
I looked around the File Exchange but could not find grangercausalitytest()
Dyuman Joshi
Dyuman Joshi 2024년 1월 29일
편집: Dyuman Joshi 2024년 1월 29일
Please share the data file "Data1.xlsx" and any user defined functions used, so that we can run your code, reproduce the error and provide suggestions/solutions. Use the paperclip button to attach.
Also, please share the complete error message you get (i.e. all of the red text).

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

태그

질문:

2024년 1월 29일

편집:

2024년 1월 29일

Community Treasure Hunt

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

Start Hunting!

Translated by