Clear Filters
Clear Filters

how to assign a value to AR model for predicting next step

4 views (last 30 days)
Hello everyone
I have a code and i estimate a model with AR (auto regressive) and I want to predict next step but it only returns the equation and do not assign value to variable in the equation(z)
Thank you for helping me
clc
clear all
close all
warning off
zafar_queue =readtable('zafar_queue.xlsx');
Y = zafar_queue.nVehContrib;
data = Y';
x_train = floor(0.9*numel(data));
dataTrain =data(1:x_train);
n = length(dataTrain);
u = 0.1* randn(n,1) ;
Opt = arxOptions;
Opt.InitialCondition = 'estimate';
arx30 = @(z)ar(dataTrain,[30], Opt);
z = 3
frcast = arx30(z)
Result after running code is this and it didn't assign 3 to z
  1 Comment
Hiro Yoshino
Hiro Yoshino on 20 Nov 2022
arx30 = @(z)ar(dataTrain,[30], Opt);
This syntax does not do anything for you.
"z" is an argument of the anonymous function arx30 but the "z" is not used for anything.

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!