Re: Seasonal Variation in Trend Analysis [message #56077 is a reply to message #56074] |
Wed, 26 September 2007 15:42  |
R.G.Stockwell
Messages: 163 Registered: October 2004
|
Senior Member |
|
|
"David Fanning" <news@dfanning.com> wrote in message
news:MPG.2164877cbc85365998a09c@news.frii.com...
> Folks,
>
> Does anyone happen to have an IDL example of some
> code that might remove seasonal variation in a time
> series? Or some suggestions for how to proceed in IDL?
> I can see that I might want to use a model that has
> sin and cosine terms, but I can't see how to find the
> coefficients of such a model in IDL.
>
> Cheers,
>
> David
Just Least Squares fit the cos and sine functions (0 phase in both
those, you get phase from the amplitudes).
Ax=b
where
[c,s] [x] = [data]
x is the unknown. c, s are your sine and cosine terms.
Use the choledky (faster) or SVD solver routines.
interesting note, if the total length of the time series is a
multiple of the length of the season, just FFT and read off those
values (real = cos, imag = sin for the appropriate frequency)
It is a 'fast' way of solving the least squares fit problem
Cheers,
bob
|
|
|