Page 1 of 1

Standardised Coefficients

Posted: Tue Mar 24, 2009 8:14 am
by EViews Gareth

Code: Select all

'This program generates some data, y and a bunch of Xs (put in a group called XS), then calculates the standardized coefficients of a regression of Y on Xs. These coefficients are put in a vector called sbetas 'To use this on a real workfile, not generated data, delete between GENERATE SOME DATA and PERFORM REGRESSION. You can change the name of the series and the name of the group containing the other series here: %seriesname = "Y" %groupname = "XS" 'GENERATE SOME DATA rndseed 1 create u 100 group {%groupname} for !i=1 to 10 %name="x" + @str(!i) series {%name} =nrnd {%groupname}.add {%name} next series {%seriesname}=nrnd 'PERFORM REGRESSION equation eq1.ls {%seriesname} {%groupname} !count={%groupname}.@count vector(!count) sbetas !stdevY = @stdev({%seriesname}) for !i=1 to !count %name={%groupname}.@seriesname(!i) !stdevX=@stdev({%name}) sbetas(!i)=eq1.@coefs(!i) * ( !stdevX/ !stdevY ) next

Re: Standardised Coefficients

Posted: Sat May 23, 2009 7:48 am
by TheRocK
Hi,

I have a question. Do I have to enter the command one-by-one or everything at once?

When I do it at once eViews is telling me "Flow of control statement executed from the command file". I assume that means that I have to enter the command somewhere else, but where?

This is the code:

equation eq10.ls(cx=f,cov=cxdiag,b) sharpe eq01_group1
!count=eq01_group1.@count
vector(!count) sbetas
!stdevy = @stdev(sharpe)
for !i=1 to !count
%name=eq01_group1.@sharpe(!i)
!stdevx=@stdev({%name})
sbetas(!i)=eq10.@coefs(!i) * ( !stdevx/ !stdevy )
next

THANKS !

Kai

Re: Standardised Coefficients

Posted: Sat May 23, 2009 7:53 am
by startz
Hi,

I have a question. Do I have to enter the command one-by-one or everything at once?

When I do it at once eViews is telling me "Flow of control statement executed from the command file". I assume that means that I have to enter the command somewhere else, but where?

This is the code:

equation eq10.ls(cx=f,cov=cxdiag,b) sharpe eq01_group1
!count=eq01_group1.@count
vector(!count) sbetas
!stdevy = @stdev(sharpe)
for !i=1 to !count
%name=eq01_group1.@sharpe(!i)
!stdevx=@stdev({%name})
sbetas(!i)=eq10.@coefs(!i) * ( !stdevx/ !stdevy )
next

THANKS !

Kai
You want to make a program. File/New/Program

Re: Standardised Coefficients

Posted: Sat May 23, 2009 8:04 am
by TheRocK
Thank you
SO MUCH
Now its working yehaw :-)

I do have another question though. The t-statistics and other statistics are still valid right ?

Cheers
Kai

Re: Standardised Coefficients

Posted: Sun May 24, 2009 1:35 am
by TheRocK
Hi,

there seems to be an error in the programm above. The coefficient completely change when you move the regressors around. The standardized coefficient should stay the same and just change position in the output; however, they dont.

Could somebody tell me where the error could be? Moreover, the output is not reporting the standardised coeff of the constant (I put 4 variables plus constant in the regression and only 4 standardised coeffs are reported). When I include the constant term in the group with the regressors, its giving me a near singular matrix.

All the best

Kai

Re: Standardised Coefficients

Posted: Tue May 26, 2009 1:10 pm
by TheRocK
Hi,

can anybody help me with this? I do not understand enough of the syntax of eviews.

However, i think the reason lies here:

!count={%groupname}.@count and here:

%groupname = "eq00_group"

As I cannot tell eviews to include the constant in the eq00_group, the vector for the standardized betas is missing one value. As the count function is excluding the constant term. Can anybody please help me correct that problem ?

All the best

Kai

Re: Standardised Coefficients

Posted: Tue May 26, 2009 1:36 pm
by EViews Gareth
Could you post your workfile, and your program so far....

Re: Standardised Coefficients

Posted: Tue May 26, 2009 11:57 pm
by TheRocK
Hi Gareth,

my workfile is unfortunately larger than 2mb so I cannot upload it. If you gave me your email address, I would send it to you immediately.

Thank you for your help !

All the best

Kai

Re: Standardised Coefficients

Posted: Wed May 27, 2009 8:04 am
by EViews Gareth