Accessing KPSS critical values in a loop

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Jason, EViews Moderator, EViews Matt

heer0
Posts: 22
Joined: Sat May 04, 2019 11:23 am

Accessing KPSS critical values in a loop

Postby heer0 » Wed Jun 26, 2019 6:13 am

EDIT: As a workaround, I have defined a vector with asymptotic critical values for the KPSS test according to the original paper and included it in the loop.

Dear community,

I would like to perform the KPSS unit root test in EViews 10 (University ed.) on a group of monthly series and store the test results (critical value > test statistic?) in a table. So far, my code reads:

Code: Select all

'Create a blank output table to store test results for the seasonally adjusted series contained in the group "monthly_x13"

table (5,monthly_x13.@count+1) KPSS_MONTHLY

setcell(KPSS_MONTHLY, 1, 1, "Test / Series", "l")
setcell(KPSS_MONTHLY, 2, 1, "KPSS (level, trend)", "l")
setcell(KPSS_MONTHLY, 3, 1, "KPSS (level, constant)", "l")
setcell(KPSS_MONTHLY, 4, 1, "KPSS (fd, trend)", "l")
setcell(KPSS_MONTHLY, 5, 1, "KPSS (fd, constant)", "l")

'Loop through all series in the group "monthly_x13"
for !i=1 to monthly_x13.@count

'Enforce the correct series names
%name = monthly_x13.@seriesname(!i)

'Obtain and store kpss test results (p-values)
uroot(kpss, trend, dif=0, save=kpss1) {%name}      'for levels, assuming an intercept and exogenous trend
KPSS_MONTHLY(1,1+!i)=%name
KPSS_MONTHLY(2, 1+!i)= kpss1(5,1)-kpss1(3,1)
uroot(kpss, const, dif=0, save=kpss2) {%name}      'for levels, assuming an intercept
KPSS_MONTHLY(3, 1+!i)= kpss2(5,1)-kpss2(3,1)
uroot(kpss, trend, dif=1, save=kpss3) {%name}      'for first difference, assuming an intercept and exogenous trend
KPSS_MONTHLY(4, 1+!i)= kpss3(5,1)-kpss3(3,1)
uroot(kpss, const, dif=1, save=kpss4) {%name}      'for first difference, assuming an intercept
KPSS_MONTHLY(5, 1+!i)= kpss4(5,1)-kpss4(3,1)

next


However, the output table gives me only 'NA' values. This is due to the fact that the matrices kpss1 to kpss5 contain only 'NA' values where the critical values should be. Somehow my routine does not properly extract the critical values.

Could you please tell me how to access the individual critical values of the kpss test?

Thank you in advance!

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

Re: Accessing KPSS critical values in a loop

Postby EViews Gareth » Wed Jun 26, 2019 7:43 am

I don't think you can retrieve them easily like that. You'd have to freeze the unit root test output into a table and then extract them from the table.
Follow us on Twitter @IHSEViews

heer0
Posts: 22
Joined: Sat May 04, 2019 11:23 am

Re: Accessing KPSS critical values in a loop

Postby heer0 » Wed Jun 26, 2019 7:51 am

EViews Gareth wrote:I don't think you can retrieve them easily like that. You'd have to freeze the unit root test output into a table and then extract them from the table.


Thank you Gareth. Makes sense!

Best wishes!


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 54 guests