Page 1 of 2

store constant and coefficient of rolling regression

Posted: Fri May 17, 2019 4:41 am
by Mai LÊ
I would like to store the constant and coefficient of each rolling regression.
Could you please help me?

Re: store constant and coefficient of rolling regression

Posted: Fri May 17, 2019 7:37 am
by EViews Gareth
What have you done so far?

Re: store constant and coefficient of rolling regression

Posted: Mon May 27, 2019 7:39 am
by Mai LÊ
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.

Re: store constant and coefficient of rolling regression

Posted: Mon May 27, 2019 7:45 am
by EViews Gareth
What have you done so far?

Re: store constant and coefficient of rolling regression

Posted: Mon May 27, 2019 7:48 am
by Mai LÊ
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.

Re: store constant and coefficient of rolling regression

Posted: Mon May 27, 2019 8:43 am
by Mai LÊ
Could you please help to show me how to save the t-value for each coefficient of the regression?

Re: store constant and coefficient of rolling regression

Posted: Mon May 27, 2019 3:25 pm
by EViews Gareth
Do exactly the same thing, but rather than use:

Code: Select all

eq!j.@coefs
use

Code: Select all

eq!j.@tstats

Re: store constant and coefficient of rolling regression

Posted: Tue May 28, 2019 12:08 am
by Mai LÊ
thanks so much for your help!

Re: store constant and coefficient of rolling regression

Posted: Tue May 28, 2019 12:18 am
by Mai LÊ
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?

Re: store constant and coefficient of rolling regression

Posted: Tue May 28, 2019 7:20 am
by EViews Gareth
@coefs(1)

Re: store constant and coefficient of rolling regression

Posted: Tue May 28, 2019 10:40 am
by Mai LÊ
thanks so much for your help!

Re: store constant and coefficient of rolling regression

Posted: Wed May 29, 2019 12:47 am
by Mai LÊ
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!

Re: store constant and coefficient of rolling regression

Posted: Wed May 29, 2019 7:25 am
by EViews Gareth
Sounds like equation 21 didn't estimate properly.

Re: store constant and coefficient of rolling regression

Posted: Sat Jun 15, 2019 8:43 pm
by Mai LÊ
If I want to store p-value instead of t-stat, what code should I use?

Re: store constant and coefficient of rolling regression

Posted: Sat Jun 15, 2019 9:31 pm
by EViews Gareth