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: 18
Joined: Mon May 06, 2019 7:09 am

store constant and coefficient of rolling regression

Postby Mai LÊ » Fri May 17, 2019 4:41 am

I would like to store the constant and coefficient of each rolling regression.
Could you please help me?

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

Re: store constant and coefficient of rolling regression

Postby EViews Gareth » Fri May 17, 2019 7:37 am

What have you done so far?
Follow us on Twitter @IHSEViews

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

Re: store constant and coefficient of rolling regression

Postby Mai LÊ » Mon May 27, 2019 7:39 am

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: 13307
Joined: Tue Sep 16, 2008 5:38 pm

Re: store constant and coefficient of rolling regression

Postby EViews Gareth » Mon May 27, 2019 7:45 am

What have you done so far?
Follow us on Twitter @IHSEViews

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

Re: store constant and coefficient of rolling regression

Postby Mai LÊ » Mon May 27, 2019 7:48 am

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: 18
Joined: Mon May 06, 2019 7:09 am

Re: store constant and coefficient of rolling regression

Postby Mai LÊ » Mon May 27, 2019 8:43 am

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: 13307
Joined: Tue Sep 16, 2008 5:38 pm

Re: store constant and coefficient of rolling regression

Postby EViews Gareth » Mon May 27, 2019 3:25 pm

Do exactly the same thing, but rather than use:

Code: Select all

eq!j.@coefs

use

Code: Select all

eq!j.@tstats
Follow us on Twitter @IHSEViews

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

Re: store constant and coefficient of rolling regression

Postby Mai LÊ » Tue May 28, 2019 12:08 am

thanks so much for your help!

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

Re: store constant and coefficient of rolling regression

Postby Mai LÊ » Tue May 28, 2019 12:18 am

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: 13307
Joined: Tue Sep 16, 2008 5:38 pm

Re: store constant and coefficient of rolling regression

Postby EViews Gareth » Tue May 28, 2019 7:20 am

@coefs(1)
Follow us on Twitter @IHSEViews

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

Re: store constant and coefficient of rolling regression

Postby Mai LÊ » Tue May 28, 2019 10:40 am

thanks so much for your help!

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

Re: store constant and coefficient of rolling regression

Postby Mai LÊ » Wed May 29, 2019 12:47 am

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: 13307
Joined: Tue Sep 16, 2008 5:38 pm

Re: store constant and coefficient of rolling regression

Postby EViews Gareth » Wed May 29, 2019 7:25 am

Sounds like equation 21 didn't estimate properly.
Follow us on Twitter @IHSEViews

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

Re: store constant and coefficient of rolling regression

Postby Mai LÊ » Sat Jun 15, 2019 8:43 pm

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: 13307
Joined: Tue Sep 16, 2008 5:38 pm

Re: store constant and coefficient of rolling regression

Postby EViews Gareth » Sat Jun 15, 2019 9:31 pm

Follow us on Twitter @IHSEViews


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 25 guests