How to report P value of a rolling regression in a table

For questions regarding programming in the EViews programming language.

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

nawal
Posts: 12
Joined: Thu Nov 19, 2015 6:22 am

How to report P value of a rolling regression in a table

Postby nawal » Thu Dec 03, 2015 8:14 am

Hi,

I am not able to report P-value of a rolling regression in the table.
Could anyone please help where I am doing wrong in the code?

I would be very thankful to you.

Below is the Code for the reference:

if @isobject("comparison") then
delete comparison
endif
'create vector to store r-squares
matrix(6,64) comparison

'create empty equation to be used inside the loop
equation eq

%smpl_start="2000Q3"
%smpl_end="2015Q2"

smpl {%smpl_start} {%smpl_end} '@last
'get size
!length = @obssmpl

!j=1
for !i = 0 to !length step 1
!j=!j+1

'smpl 1996q1+!i 1996q1+8+!i
smpl {%smpl_start} {%smpl_start}+!i+30
eq.ls 'Put your Model equation here

'store coefficients into matrix
comparison = @tdist(eq.@tstat(2), eq.@regobs - eq.@ncoefs)
next

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

Re: How to report P value of a rolling regression in a table

Postby EViews Gareth » Thu Dec 03, 2015 8:27 am

What have you done so far, and how doesn't it work?

nawal
Posts: 12
Joined: Thu Nov 19, 2015 6:22 am

Re: How to report P value of a rolling regression in a table

Postby nawal » Thu Dec 03, 2015 9:26 pm

What have you done so far, and how doesn't it work?

Hi,

I wrote this code to test the Robustness of the parameters of my equation.
My time period is 2000Q1 to 2015Q2 and from the above equation I solved parameters for different time period like 2000Q to 2007Q4 then 2000Q1 to 2008Q1 etc.
There is an incremental of 1 quarter for each sample.

Below is the code for the same:
'store coefficients into matrix
colplace(comparison, eq.@coefs, !j)

For the p-value of these estimates, I replaced colplace(comparison, eq.@coefs, !j) with comparison = @tdist(eq.@tstat(2), eq.@regobs - eq.@ncoefs)

Please help me to sort out this problem. I don't know so much on Eviews Programming.
I would be very thankful to you.

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

Re: How to report P value of a rolling regression in a table

Postby EViews Gareth » Thu Dec 03, 2015 11:15 pm

Which version of EViews?

nawal
Posts: 12
Joined: Thu Nov 19, 2015 6:22 am

Re: How to report P value of a rolling regression in a table

Postby nawal » Thu Dec 03, 2015 11:35 pm

Which version of EViews?

It is Eviews 9

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

Re: How to report P value of a rolling regression in a table

Postby EViews Gareth » Thu Dec 03, 2015 11:47 pm

Then just do exactly the same thing as was done to store the coefficients, but use eq.@pvals instead of eq.@coefs

nawal
Posts: 12
Joined: Thu Nov 19, 2015 6:22 am

Re: How to report P value of a rolling regression in a table

Postby nawal » Thu Dec 03, 2015 11:57 pm

Then just do exactly the same thing as was done to store the coefficients, but use eq.@pvals instead of eq.@coefs

Thanks a lot... You are a life saver Gareth!

nawal
Posts: 12
Joined: Thu Nov 19, 2015 6:22 am

Re: How to report P value of a rolling regression in a table

Postby nawal » Wed Dec 16, 2015 11:08 pm

Then just do exactly the same thing as was done to store the coefficients, but use eq.@pvals instead of eq.@coefs

Thanks a lot... You are a life saver Gareth!
Hi Gareth,

I am running a Error correction model and to check the robustness of the parameter, I have to run the rolling regression on the same:
Below is the code I am using for the same:

if @isobject("comparison") then
delete comparison
endif
'create vector to store r-squares
matrix(7,64) comparison

'create empty equation to be used inside the loop
var Dealer

%smpl_start="2000Q1"
%smpl_end="2015Q2"

smpl {%smpl_start} {%smpl_end} '@last
'get size
!length = @obssmpl

!j=1
for !i = 0 to !length step 1
!j=!j+1

'smpl 1996q1+!i 1996q1+8+!i
smpl {%smpl_start} {%smpl_start}+!i+20
var Dealer.EC(B,1) 1 1 --- Equation of the VAR model

'store coefficients into matrix
'colplace(comparison, dealer.@coint(b,1), !j)
series alpha= dealer.a(1,1)
next

But I am getting only zero in the entire series.

Could you please help me how to write the code to get the estimates of VAR Model in the matrix?

I would be very thankful to you
show comparison


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests