differencing a time series
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I want to difference a time series till it becomes stationary.how to code it using matlab.i am writing my code below.please help me to continue it acf=autocorr of time series
l(k)=lower limit
u(k)=upper limit
if ((acf(k+1)<l(k)) || (acf(k+1)>u(k))),a time series is non-stationary.now i have to difference a time series till it becomes stationary.how to write using a single expression.
2 commentaires
dpb
le 10 Août 2013
Modifié(e) : dpb
le 10 Août 2013
What's k supposed to represent--the k-th lag of the acf series or the acf after the k-th difference of x?
Maybe my utility function can help some w/ the complexity -- it's just syntactic sugar but by putting the logic expressions at a lower level it can often lead to seeing how to reduce expressions...
while ~all(iswithin(acf,l,u))
... do another difference here
end
where acf is presumed to be the acf at the kth iteration
iswithin is
function flg=iswithin(x,lo,hi)
% returns T for values within range of input
% SYNTAX:
% [log] = iswithin(x,lo,hi)
% returns T for x between lo and hi values, inclusive
flg= (x>=lo) & (x<=hi);
Réponses (1)
dpb
le 11 Août 2013
OK, presuming you have a vector of given length and the limits of the same, then
(acf(k+1)<l(k)) || (acf(k+1)>u(k)))
is
acf(2:end)<l || acf(2:end)>u
if do want the short-circuiting operator here.
0 commentaires
Voir également
Catégories
En savoir plus sur Mathematics and Optimization dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!