Peak-to-Peak Interpolation

For questions regarding the import, export and manipulation of data in EViews, including graphing and basic statistics.

Moderators: EViews Gareth, EViews Steve, EViews Moderator, EViews Jason

Riaz
Posts: 33
Joined: Wed Jul 01, 2009 1:46 am
Location: Western Australia

Peak-to-Peak Interpolation

Postby Riaz » Tue Mar 23, 2010 8:42 pm

Hi QMS

I'm trying to generate a series to join all the peaks in the following data series. Could you please help me?

1952Q1 0.2327177041391268
1952Q2 0.2326344161528581
1952Q3 0.2324972995972921
1952Q4 0.2373741302204194
1953Q1 0.2403010155375783
1953Q2 0.2406725453982633
1953Q3 0.2360694730044223
1953Q4 0.230786591291274
1954Q1 0.2277163190186312
1954Q2 0.2252013515750048
1954Q3 0.2256348736221765
1954Q4 0.2278702431449002
1955Q1 0.2319207122624642
1955Q2 0.2326840671641765
1955Q3 0.2325406669312288
1955Q4 0.2308972279676285
1956Q1 0.2281967729984845
1956Q2 0.2279244832652977
1956Q3 0.2246146845088473
1956Q4 0.2263607742956181
1957Q1 0.2258036151569085
1957Q2 0.2229505248103341
1957Q3 0.22258713268032
1957Q4 0.220513108069454
1958Q1 0.213970592248264
1958Q2 0.215354753800645
1958Q3 0.2191919605758793
1958Q4 0.2234866980366456
1959Q1 0.2267747054371057
1959Q2 0.2310586118459958
1959Q3 0.229292727782707
1959Q4 0.2279567566577745
1960Q1 0.2293727429770108
1960Q2 0.2254381556305993
1960Q3 0.2245082955151426
1960Q4 0.2212369283726183
1961Q1 0.221808679838325
1961Q2 0.2243285853809768
1961Q3 0.2259416030683028
1961Q4 0.2288242675296656
1962Q1 0.2307842044107881
1962Q2 0.2314472000031549
1962Q3 0.2322232616204627
1962Q4 0.2312089466357558
1963Q1 0.2317286528549212
1963Q2 0.2325947023314243
1963Q3 0.2362661127261581
1963Q4 0.2359308894796145
1964Q1 0.2385820622743554
1964Q2 0.2380311446741579
1964Q3 0.2380250918439464
1964Q4 0.2360296786070454
1965Q1 0.238209237639302
1965Q2 0.2380342728588754
1965Q3 0.2397184582884502
1965Q4 0.2413121949601053
1966Q1 0.2426676322770959
1966Q2 0.2396349987674688
1966Q3 0.2368406514027804
1966Q4 0.2341587233754987
1967Q1 0.2341513744956512
1967Q2 0.2318874376001457
1967Q3 0.2313809642162528
1967Q4 0.2307076163909527
1968Q1 0.2316622616585448
1968Q2 0.2328302890216911
1968Q3 0.231347600675237
1968Q4 0.2303606650603539
1969Q1 0.2310972377769015
1969Q2 0.228085072215133
1969Q3 0.2265277595532649
1969Q4 0.2219936000325838
1970Q1 0.2202139003812059
1970Q2 0.2175318983426522
1970Q3 0.2176452923416808
1970Q4 0.214640101845208
1971Q1 0.218108400489793
1971Q2 0.2180116109517473
1971Q3 0.2178380614670414
1971Q4 0.2170905126778223
1972Q1 0.2194933036133864
1972Q2 0.223246364265225
1972Q3 0.2228851614529306
1972Q4 0.2243341387244281
1973Q1 0.2270596089249605
1973Q2 0.2266462388647731
1973Q3 0.2223359792028552
1973Q4 0.2214823921462133
1974Q1 0.2166687079456214
1974Q2 0.2150838924120624
1974Q3 0.2109581314901029
1974Q4 0.2078534203162045
1975Q1 0.2048121496822496
1975Q2 0.2053248030633064
1975Q3 0.2076661547656079
1975Q4 0.2093210995299375
1976Q1 0.2129386038889397
1976Q2 0.212845157867717
1976Q3 0.2121971220578044
1976Q4 0.2129771823309137
1977Q1 0.213965953914483
1977Q2 0.2166163647441324
1977Q3 0.2181498824388806
1977Q4 0.2161700358096096
1978Q1 0.2151279977511563
1978Q2 0.2206907414877331
1978Q3 0.2201192196646395
1978Q4 0.2203594080196517
1979Q1 0.2180758745395004
1979Q2 0.2164280539698817
1979Q3 0.2154635561537697
1979Q4 0.2137677454363309
1980Q1 0.2119248151544334
1980Q2 0.2051289995516399
1980Q3 0.2029817353959674
1980Q4 0.2053075584168039
1981Q1 0.2072630699123173
1981Q2 0.2042899445201667
1981Q3 0.2034749686948514
1981Q4 0.1991772635526628
1982Q1 0.1950084493905952
1982Q2 0.1945098494782308
1982Q3 0.1931208550358923
1982Q4 0.1929065508897108
1983Q1 0.1948170284910932
1983Q2 0.1986602432011801
1983Q3 0.2022361646665255
1983Q4 0.2048440026792868
1984Q1 0.2068898785325855
1984Q2 0.208776692697103
1984Q3 0.2090496772806254
1984Q4 0.208882570124395
1985Q1 0.2085774363427392
1985Q2 0.2085873568071488
1985Q3 0.2099909063141514
1985Q4 0.2099469573159464
1986Q1 0.2102466953782856
1986Q2 0.2100608888690338
1986Q3 0.2109399874124369
1986Q4 0.2108996299552632
1987Q1 0.2113500086366573
1987Q2 0.2118845032407771
1987Q3 0.2119445136214466
1987Q4 0.214631112599909
1988Q1 0.2147868677039417
1988Q2 0.2160290923773347
1988Q3 0.215779984571936
1988Q4 0.2178828984498867
1989Q1 0.2179837397661568
1989Q2 0.2182958057493109
1989Q3 0.2189314558828283
1989Q4 0.2185548101600577
1990Q1 0.2188674511362097
1990Q2 0.2186935230058445
1990Q3 0.2173644640064822
1990Q4 0.2143024560790468
1991Q1 0.2114085534269512
1991Q2 0.2124564795374537
1991Q3 0.2128377777576521
1991Q4 0.2134123319840112
1992Q1 0.2149645455336368
1992Q2 0.2169439985934033
1992Q3 0.2221574333642265
1992Q4 0.2211134966234327
1993Q1 0.221083955649655
1993Q2 0.2212234614454032
1993Q3 0.2218549942012256
1993Q4 0.223592931301751
1994Q1 0.2274424192170204
1994Q2 0.2278909900376138
1994Q3 0.2279208323032512
1994Q4 0.2290731055025104
1995Q1 0.227444278248516
1995Q2 0.2258504316301418
1995Q3 0.2259516928351323
1995Q4 0.2268522118093424
1996Q1 0.2268535248449609
1996Q2 0.2291773982061741
1996Q3 0.2295133466819923
1996Q4 0.2304238144253242
1997Q1 0.229760311956437
1997Q2 0.2313698026272038
1997Q3 0.2320421680174972
1997Q4 0.2317742717588315
1998Q1 0.2328817193693353
1998Q2 0.2332675214871319
1998Q3 0.234594063791076
1998Q4 0.2362677697237215
1999Q1 0.2357518369264592
1999Q2 0.235270904567756
1999Q3 0.2358429518502909
1999Q4 0.2378507685774864
2000Q1 0.2358372902173955
2000Q2 0.2386660801454857
2000Q3 0.2361144775676263
2000Q4 0.2352380178642587
2001Q1 0.2313722199395774
2001Q2 0.2316701776507667
2001Q3 0.2290088841006316
2001Q4 0.2274199062782914
2002Q1 0.2280530148847514
2002Q2 0.2283490825675403
2002Q3 0.2287799039866885
2002Q4 0.2277764951038867
2003Q1 0.2276892887023154
2003Q2 0.2284747253756475
2003Q3 0.2320795577091946
2003Q4 0.2333891608618879
2004Q1 0.2342380489768863
2004Q2 0.2356137062870445
2004Q3 0.2380992083619885
2004Q4 0.2371691028465249
2005Q1 0.2381436013959844
2005Q2 0.2394550803546715
2005Q3 0.2425782001885972
2005Q4 0.2414987343064955
2006Q1 0.2417690447559832
2006Q2 0.241350937783585
2006Q3 0.2403546256690721
2006Q4 0.2407177270588788
2007Q1 0.2413989314919202
2007Q2 0.2414827937945569
2007Q3 0.2427949382422642
2007Q4 0.2439107412415718
2008Q1 0.2400127848329386
2008Q2 0.2399250440027759
2008Q3 0.2375349057737806
2008Q4 0.2353556295911726
2009Q1 0.2279923533756998
2009Q2 0.226589109424868
2009Q3 0.2263060451350292
2009Q4 0.2297561555473523
2010Q1 0.2315688545999573

Many thanks, Riaz

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13584
Joined: Tue Sep 16, 2008 5:38 pm

Re: Peak-to-Peak Interpolation

Postby EViews Gareth » Tue Mar 23, 2010 8:52 pm

Can you be a bit more explicit? How are you defining a "peak"?

Riaz
Posts: 33
Joined: Wed Jul 01, 2009 1:46 am
Location: Western Australia

Re: Peak-to-Peak Interpolation

Postby Riaz » Tue Mar 23, 2010 9:45 pm

Peak points are apex-points. For series in query they are:

Peak 1 = 1953q3
Peak 2 = 1955q2
Peak 3 = 1956q4
Peak 4 = 1959q2
Peak 5 = 1960q1
Peak 6 = 1962q3
... and so forth.

I want to generate a series that would join these apex points through the entire series until the last apex point.

In the new series, from the first observation until 1953q3 all the values would be 0.240673, which is the value of 1953q3 observation.

From 1953q3 to 1955q2 I need a series that would join these two peak points. Likewise, from 1955q2 t0 1956q4 and 1956q4 to 1959q2 and 1959q2 to 1960q1 and so forth.

The value of the last apex point will be the value of all the observations from that point onwards until the end of the series.

I hope this clarifies my request.

Cheers, Riaz

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13584
Joined: Tue Sep 16, 2008 5:38 pm

Re: Peak-to-Peak Interpolation

Postby EViews Gareth » Wed Mar 24, 2010 8:01 am

I'm afraid I still don't follow exactly. From your data, I don't see how you are defining an "apex point". I also don't follow your example, since you seem to have got the observations wrong?

Could you define, mathematically, what you want an apex to be?


(I'm guessing you want it such that if x(-1)<x>x(+1), but your examples don't seem to suggest that).

Riaz
Posts: 33
Joined: Wed Jul 01, 2009 1:46 am
Location: Western Australia

Re: Peak-to-Peak Interpolation

Postby Riaz » Tue Apr 06, 2010 2:08 am

Hi
I want to create a series that would connect all the local maxima.
Does that help?
Thanks, Riaz

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13584
Joined: Tue Sep 16, 2008 5:38 pm

Re: Peak-to-Peak Interpolation

Postby EViews Gareth » Tue Apr 06, 2010 6:41 am

Not unless you can state how you're defining a local maxima.

Riaz
Posts: 33
Joined: Wed Jul 01, 2009 1:46 am
Location: Western Australia

Re: Peak-to-Peak Interpolation

Postby Riaz » Tue Apr 06, 2010 7:16 pm

Unfortunately, I do not know how to define it.

The idea was taken from the Fair Model EViews Version.

http://fairmodel.econ.yale.edu/eviews/eviews.htm Workfile: FM.wfl

The variables of interest are:

(1) CDA = peak to peak interpolation of CD/POP and
(2) HFS = peak to peak interpolation of HF

If you plot CDA and (CD/POP)
CDANCDPOP.GIF
CDANCDPOP.GIF (4.38 KiB) Viewed 14700 times


and If you plot HF and HFS
HFSNHF.GIF
HFSNHF.GIF (4.98 KiB) Viewed 14700 times
In both cases I want to generate the series in blue.

I hope this helps.

Riaz
Posts: 33
Joined: Wed Jul 01, 2009 1:46 am
Location: Western Australia

Re: Peak-to-Peak Interpolation

Postby Riaz » Wed Apr 07, 2010 12:32 am

LineFit.xls
(61 KiB) Downloaded 795 times
I managed to generate the line in XL and because I'm not good in EViews Scripting I cant do it in EViews.

The Y' is the series that I want.

May be this would be helpful.

Cheers.

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13584
Joined: Tue Sep 16, 2008 5:38 pm

Re: Peak-to-Peak Interpolation

Postby EViews Gareth » Wed Apr 07, 2010 8:19 am

Got it. Easy:

Code: Select all

series max = @recode(y>y(-1) and y>y(+1),y,na) max.ipolate ymax d max

Riaz
Posts: 33
Joined: Wed Jul 01, 2009 1:46 am
Location: Western Australia

Re: Peak-to-Peak Interpolation

Postby Riaz » Wed Apr 07, 2010 7:10 pm

Thank you so much.

Riaz
Posts: 33
Joined: Wed Jul 01, 2009 1:46 am
Location: Western Australia

Re: Peak-to-Peak Interpolation

Postby Riaz » Wed Apr 07, 2010 9:44 pm

I get an error message when I run the script as you've suggested.

IPOLATE is not a valid view for MAX in "DO_ MAX.IPOLATE YAMX"
Attachments
peaktopeak.WF1
(12.04 KiB) Downloaded 571 times
peaktopeak.prg
(75 Bytes) Downloaded 625 times

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13584
Joined: Tue Sep 16, 2008 5:38 pm

Re: Peak-to-Peak Interpolation

Postby EViews Gareth » Wed Apr 07, 2010 9:51 pm

You need EViews 7.

Riaz
Posts: 33
Joined: Wed Jul 01, 2009 1:46 am
Location: Western Australia

Re: Peak-to-Peak Interpolation

Postby Riaz » Wed Apr 07, 2010 10:46 pm

Ok Thanks
We have E7, but will be installing after some major work is finished.
Thanks anyway.


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 2 guests