Page 1 of 3

Spectral Analysis*

Posted: Sat Feb 22, 2014 1:53 pm
by NicolasR
This thread is about the Spectral Analysis add-in which calculates various spectral analysis tools for time series :series:. It's an improved version of the periodogram add-in, it has new methods to calculate spectal density and a significance test signal that could be used as a white noise test.

Regards, Nicolas Ronderos Pulido

Re: Spectral Analysis*

Posted: Sun Feb 23, 2014 12:49 pm
by ecofin
It is exactly what I need, Thank you for all your efforts, I'm :D .

Re: Spectral Analysis*

Posted: Thu Feb 27, 2014 1:05 pm
by trubador
Yes, a very comprehensive and useful add-in. Thanks for sharing...

Re: Spectral Analysis*

Posted: Wed Aug 13, 2014 10:54 am
by felix.casares
i don´t know much about spectral analysis, can i use one of any elements ofs this to make hp filter for daily frequency time serie?

please help

Re: Spectral Analysis*

Posted: Wed Aug 13, 2014 2:45 pm
by NicolasR
The Hodrick Prescott filter is a low pass filter, that is, it preserves the low frequency components in the spectrum (long run). Therefore, you can use the estimated spectrum of your series to see if there is any significant peak at the low frequency components, if there is not, the smoothed series with de HP filter would be based on artificially inflated frequency components.

Hope it helps.

Regads.

Re: Spectral Analysis*

Posted: Tue Jan 13, 2015 1:51 pm
by NicolasR
The version 2.0 of the spectral analysis add-in is now available. It contains tests for detecting periodic components, white noise and Gaussian white noise, also it performs an automatic procedure for extracting cycles of a time series, named significant pass filter (SPF). The add-in could also be used to perform dynamic Fourier analysis, the program file can be found below and in the add-in file. In the PDF document of the add-in are showed the spectral theory of economic series and some examples using the add-in applied to data of the Industrial Production Index, the Chicago Board Options Exchange S&P 100 volatility index (VXO) and the exchange rate Euro/Dollar.

Regads.

Code: Select all

mode quiet
'---------------------------------------------------------------Dynamic Spectra Inputs----------------------------------------------------------------
!step=1 'Step parameter for the rolling
!window=100 'Number of data that will be used to estimate the spectrum
'-----------------------------------------------------------------Static Spectral Inputs------------------------------------------------------------------
%series="vxo"
%s_window="Bartlett-Priestley" 'Periodogram, Hamming, Hann, Bartlett, Parzen, Truncated, Daniell, Bartlett-Priestley
!criteria=0.05 'Selection criteria for the spectral filter
%log_scale="N" 'Y/N
!truncation=20 'Truncation point
'----------------------------------------------------------------------------------------------------------------------------------------------------------------
!obs=@obs({%series})
!start=@ifirst({%series})
!end=@ilast({%series})
!nrolls=(!obs-!window)/!step
!loop=0
for !i=0 to !obs-!window step !step
   !loop=!loop+1
   %first = @otod(!start+!i)
   %last = @otod(!start+!i+!window)
   smpl {%first} {%last}
      if %log_scale="N" then
         {%series}.spectral({%s_window},table,truncation=!truncation,criteria=!criteria)
      else if %log_scale="Y" then
         {%series}.spectral({%s_window},table,truncation=!truncation,criteria=!criteria,log)
      endif
   endif
   for !j=1 to !window/2
      table(!window/2+1,!nrolls+2) dynamic(1,!loop+1)=@pagesmpl
      table(!window/2+1,!nrolls+2) dynamic(!j+1,1)=data(!j+1,2)
      table(!window/2+1,!nrolls+2) dynamic(!j+1,!loop+1)=data(!j+1,4)
   next
   for !j=!start to @obsrange
      if !criteria<1 then
         if sf_wsum(!j)<>NA then
            vector(@obsrange,1) cycle(!j,1)=sf_wsum(!j)
         endif
      else
         if mf_wsum(!j)<>NA then
            vector(@obsrange,1) cycle(!j,1)=mf_wsum(!j)
         endif
      endif
   next
   if !criteria<1 then
      %s_m="s"
      else
      %s_m="m"
   endif
   if %s_window="Periodogram" then
      delete data {%s_m}f_wsum {%s_window}01
   else if %s_window="Bartlett-Priestley" then
         %priestley=@right(%s_window,9)
         delete data periodogram_{%priestley} {%s_m}f_wsum
         else
         delete data periodogram_{%s_window} {%s_m}f_wsum
      endif
   endif
   scalar roll=@floor((!loop/!nrolls)*100)
   !roll_=roll
   statusline Rolling Percentaje: (!roll_%)
next
smpl @all
mtos(cycle,stochastic_cycle)
delete roll cycle
'----------------------------------------------------------------------------------------------------------------------------------------------------------------

Re: Spectral Analysis*

Posted: Mon Feb 09, 2015 11:35 am
by lofficer
I have version 2.0 of spectralanalysis. In order to do cross-spectral analysis, I need sine and cosine coefficients by frequency, not just plotted. Please help. Explain how I can do this without entering your program. If I alter your program, there will be future issues when you alter your program and I want to stick to your program. Thanks.

Re: Spectral Analysis*

Posted: Tue Feb 10, 2015 12:45 pm
by NicolasR
Hi lofficer,

The add-in only performs univariate spectral analysis, in fact I´m working on a cross spectral analysis add-in I belive it will be ready in a couple of months.

Re: Spectral Analysis*

Posted: Wed Feb 11, 2015 10:44 am
by lofficer
Thanks. I look forward to your cross-spectral program.

Re: Spectral Analysis*

Posted: Sat Feb 14, 2015 2:19 am
by clubmed
thanks for the STR Add-in it's very useful 8)
i have two suggestions,
1-can you improve this Add-in to calculate (views the series of cumulative and frequency) and show the Cumulative spectral distribution (graph).
2-EViews 9 beta can now estimate the ARFIMA model, can you write an Add-in test of GPH (Geweke-Porter-Hudak test long memory).

Kind Regards. MED

Re: Spectral Analysis*

Posted: Mon Feb 16, 2015 9:00 am
by NicolasR
The cumulative spectrum could be calculated simply with the command @cumsum(%spectrum_name). The test sounds interesting but it is not in my plans, sorry.

Best regards.

Nicolas.

Re: Spectral Analysis*

Posted: Mon Apr 27, 2015 7:20 am
by StoyanKiryazov
Hi Nicolas,

many thanks for the great add-in. It is really helpful. May I ask if you have any progress with the cross-spectral tools? A few months ago you mentioned you were working on this.

Thank you.

Kind regards,
Stoyan

Re: Spectral Analysis*

Posted: Sun Jun 07, 2015 10:59 am
by nicotrader
Hi all, i have a problem with spectral analysis add in.
I work with high frequency financial observation.
Whit more 10.0000 observation the system returns error "OUT OF MEMORY MATRIX"
Can you fix this problem?

Re: Spectral Analysis*

Posted: Tue Jun 09, 2015 7:27 am
by NicolasR
Hi,

If you are working with 100.000 observations the add-in will not work. However if you click options-->General options-->Advanced system options and change the memory reserved for windows to 200 you will probably can work with 12000 observations (in a 32 bit version). Increase the temporal aggregation will afect the short-run cycle that you might find, In financial data I doubt that there is a cicle of this type. What are you trying to find or prove?

Regards.

Re: Spectral Analysis*

Posted: Tue Jun 09, 2015 11:23 am
by nicotrader
Nicolas i m work with high frequency data (5min rivelation), in one day, for exp. Sep500 future there are 250 5min rivelation multiply for cycle of 30 day or more and get a 7500 observation, multiply for back test 2 years at least.....

I think software should allow econometric analysis of time series high frequency, everything else is the past.
I urge you to implement the software. I paid this software 1750 Dollars!