📄 decompa.m
字号:
function [perc,stochc]=decompA(L,beg_i,end_i,N);
%DECOMPA Differencing-smoothing daily data decomposition.
% [PERC,STOCHC]=DECOMPA(L,BEG_I,END_I,N) decomposes daily data
% L(BEG_I:END_I) into seasonal (deterministic, periodic) component PERC
% and stochastic component STOCHC using the differencing-smoothing
% technique, see [1], Section 2.4.1. (N+1) is the number of weeks used;
% data vector L is required to include at least (N+1)*7 values preceding
% BEG_I.
%
% Reference(s):
% [1] R.Weron (2007) "Modeling and Forecasting Electricity Loads and
% Prices: A Statistical Approach", Wiley, Chichester.
% Written by Adam Misiorek and Rafal Weron (2006.09.22)
% Copyright (c) 2006 by Rafal Weron
datal = end_i-beg_i+1;
stochc = zeros(datal,1);
perc = zeros(datal,1);
start = beg_i-1;
for i=1:datal
% seasonal (deterministic, periodic) component
perc(i) = mean(L(start+i-7:-7:start+i-N*7)) + ...
mean(L(start+i-1:-1:start+i-7)) - mean(L(start+i-7-1:-1:start+i-(N+1)*7));
% stochastic component
stochc(i) = L(start+i)-perc(i);
end;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -