
Regards, Nicolas Ronderos Pulido
Moderators: EViews Gareth, EViews Moderator, EViews Esther
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
'----------------------------------------------------------------------------------------------------------------------------------------------------------------
Users browsing this forum: No registered users and 7 guests