Matching the average of the cubic spline interpolation to equal the high frequency data

For requesting general information about EViews, sharing your own tips and tricks, and information on EViews training or guides.

Moderators: EViews Gareth, EViews Moderator

saranya
Posts: 41
Joined: Wed Nov 16, 2016 5:51 am

Matching the average of the cubic spline interpolation to equal the high frequency data

Postby saranya » Tue Jan 24, 2017 4:44 am

Hi,
I wanted to convert an annual series to quarterly using cubic spline interpolation in such a way that the average of the cubic interpolation for the year equal exactly the series at an annual basis.
lets say:
What I have currently: Data from 2010 to 2015 in annual terms. ----- (1)

I need the same data in quarterly series-- for which I do a cubic spline interpolation. Now I get data from 2010 q1 to 2015 q1. (By using Match = first) ---(2)

what I need: average of the cubic spline for each year should equal the annual series-- ie the average of data for each year in (2) should exactly equal the annual series we have in (1)

Is this possible via EViews?

Hoping to receive a reply soon

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

Re: Matching the average of the cubic spline interpolation to equal the high frequency data

Postby EViews Gareth » Tue Jan 24, 2017 8:33 am

There is no built in way to do it, no.

saranya
Posts: 41
Joined: Wed Nov 16, 2016 5:51 am

Re: Matching the average of the cubic spline interpolation to equal the high frequency data

Postby saranya » Mon Jan 30, 2017 1:56 am

Thanks Gareth. Also, is it possible to take some text from an excel spread sheet to eviews? For instance, I want some bloomberg or haver based codes incorporated in the fetch functionality. i.e, I want to make the codes dynamic and thereby allow the user to delete or add any codes of the data series to the excel sheet instead of doing the same in E-views based programme. Is it possible?

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

Re: Matching the average of the cubic spline interpolation to equal the high frequency data

Postby EViews Gareth » Mon Jan 30, 2017 8:36 am

You can use the importtbl command to import the Excel codes into a table, then read them from the table.

houji
Posts: 18
Joined: Mon Mar 20, 2023 3:19 pm

Re: Matching the average of the cubic spline interpolation to equal the high frequency data

Postby houji » Mon May 26, 2025 1:58 pm

Hi Gareth,

I think the cubicaverage would be a great function to implement in the future, much like the quadratic average. in the meantime, how difficult would it be for me to create a user script to perform the cubic average algo?

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

Re: Matching the average of the cubic spline interpolation to equal the high frequency data

Postby EViews Gareth » Mon May 26, 2025 2:44 pm

Without knowing the exact details of the calculation, hard to say. But probably not too bad

houji
Posts: 18
Joined: Mon Mar 20, 2023 3:19 pm

Re: Matching the average of the cubic spline interpolation to equal the high frequency data

Postby houji » Tue May 27, 2025 2:27 pm

I had something in mind as the SPATQ function in TROLL.

Format: SPATQ( series [, levelflag ] )

series = an annual numeric timeseries

levelflag = NA, FALSE or 0 (treat series as a flow: equalize
sums)
TRUE or 1 (treat series as a level: equalize
means)
Usage: Function (DO commands, programs)

Return Value: A quarterly timeseries interpolated from the annual input series using a cubic spline.

SPATQ calculates a spline function for the input series (which must have annual periodicity) and evaluates the function at quarterly intervals. The output series is quarterly and has four values for every value in the input series. By default, the input series is treated as a flow variable and, therefore, the mean of the output series is 1/4 the mean of the input series. However, if a levelflag is specified, the output series is multiplied by 4 to equalize the two means. If the levelflag is omitted, the output series is not multiplied by 4.


Return to “General Information and Tips and Tricks”

Who is online

Users browsing this forum: No registered users and 1 guest