Estimating the decay parameter in Exponentially Weighted Moving Average (EWMA) model

조회 수: 7 (최근 30일)
Given the data , ; I would like to like to estimate the decay parameter λ in Exponentially Weighted Moving Average (EWMA) model, such that
where is the error term in the nonlinear regression, .
I am wondering, is there any convenient way to estimate the decay parameter λ uisng nonlinear fitting function? Because K could be very large, which around 200.

답변 (1개)

Pranavkumar Mallela
Pranavkumar Mallela 2023년 7월 12일
편집: Pranavkumar Mallela 2023년 7월 27일
Hi,
As per my understanding, you want to estimate the decay parameter using a non-linear fitting function.
This can be done using the 'fminsearch' function.
Please find the code for the same as follows:
K = 4; % value of K
y = [1 4 8 16 32 64 128 256 512 1024]; % your data
lambda_initial = 0.5; % starting value of lambda
objective = @(lambda) sum((y-EWMA(lambda,y,K)).^2); % function handle of the function to be minimized
lambda_estimated = fminsearch(objective, lambda_initial) % calling fminsearch to find lambda
lambda_estimated = 1.1158
% function to compute the series using the EWMA model
function result = EWMA(lambda,y,K)
N = numel(y);
% result that is fed into the objective function
result = [];
% iterate for each term
for t=1:N
yt = 1;
% iterate for all k <= K
for k=1:K
if t-k <= 0
continue
end
yt = yt + lambda^k * result(t-k);
end
result = [result yt];
end
end
For more information regarding the 'fminsearch' function, please refer to the following documentation: https://www.mathworks.com/help/matlab/ref/fminsearch.html
Hope this helps! Thanks!

카테고리

Help CenterFile Exchange에서 Linear and Nonlinear Regression에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by