store constant and coefficient of rolling regression

For questions regarding programming in the EViews programming language.

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

Mai LÊ
Posts: 12
Joined: Mon May 06, 2019 7:09 am

store constant and coefficient of rolling regression

I would like to store the constant and coefficient of each rolling regression.

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

Re: store constant and coefficient of rolling regression

What have you done so far?

Mai LÊ
Posts: 12
Joined: Mon May 06, 2019 7:09 am

Re: store constant and coefficient of rolling regression

I found the solution to store the constant and coefficient.
But I don't know how to store the probability/t-value for each coefficient.

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

Re: store constant and coefficient of rolling regression

What have you done so far?

Mai LÊ
Posts: 12
Joined: Mon May 06, 2019 7:09 am

Re: store constant and coefficient of rolling regression

My regression equation: strategy_rate_!j = alpha + beta*actual_rate_!j
This is my code:
========
for !j=1 to 28
genr strategy_rate_!j = strategy_return_!j - rate_!j
genr actual_rate_!j = return_!j - rate_!j
equation eq!j.ls strategy_rate_!j c actual_rate_!j
matrix(2,28) alpha_beta
colplace(alpha_beta,eq!j.@coefs,!j)
next
=========
I want to save value of alpha, beta, and its t-value. But I just wrote code to save alpha and beta.

Mai LÊ
Posts: 12
Joined: Mon May 06, 2019 7:09 am

Re: store constant and coefficient of rolling regression

Could you please help to show me how to save the t-value for each coefficient of the regression?

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

Re: store constant and coefficient of rolling regression

Do exactly the same thing, but rather than use:

Code: Select all

`eq!j.@coefs`

use

Code: Select all

`eq!j.@tstats`

Mai LÊ
Posts: 12
Joined: Mon May 06, 2019 7:09 am

Re: store constant and coefficient of rolling regression

thanks so much for your help!

Mai LÊ
Posts: 12
Joined: Mon May 06, 2019 7:09 am

Re: store constant and coefficient of rolling regression

I have one more question.
The code "@coefs" is to save all coefficients of the regression.
Can we save only one coefficient and t-stat at a time?

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

Re: store constant and coefficient of rolling regression

@coefs(1)

Mai LÊ
Posts: 12
Joined: Mon May 06, 2019 7:09 am

Re: store constant and coefficient of rolling regression

thanks so much for your help!

Mai LÊ
Posts: 12
Joined: Mon May 06, 2019 7:09 am

Re: store constant and coefficient of rolling regression

This is my code to extract the coefficients and t-stat of the regression in a table.
========
for !j=1 to 28
genr strategy_rate_!j = strategy_return_!j - rate_!j
genr actual_rate_!j = return_!j - rate_!j
equation eq!j.ls strategy_rate_!j c actual_rate_!j
matrix(28,4) alpha_beta
alpha_beta(!j,1) = eq!j.@coefs(1)
alpha_beta(!j,2) = eq!j.@tstats(1)
alpha_beta(!j,3) = eq!j.@coefs(2)
alpha_beta(!j,4) = eq!j.@tstats(2)
next
========
Eviews shows an error: "Division by zero in ALPHA_BETA(21,2) = EQ21.@tstat(1)"
What is the problem? How can I fix it?
Thanks!

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

Re: store constant and coefficient of rolling regression

Sounds like equation 21 didn't estimate properly.

Mai LÊ
Posts: 12
Joined: Mon May 06, 2019 7:09 am

Re: store constant and coefficient of rolling regression

If I want to store p-value instead of t-stat, what code should I use?

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