Standardised Coefficients

For posting your own programs to share with others

Moderators: EViews Gareth, EViews Moderator

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

Standardised Coefficients

Postby EViews Gareth » Tue Mar 24, 2009 8:14 am

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


Follow us on Twitter @IHSEViews

TheRocK
Posts: 20
Joined: Sun Jan 18, 2009 4:18 am

Re: Standardised Coefficients

Postby TheRocK » Sat May 23, 2009 7:48 am

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

startz
Non-normality and collinearity are NOT problems!
Posts: 3775
Joined: Wed Sep 17, 2008 2:25 pm

Re: Standardised Coefficients

Postby startz » Sat May 23, 2009 7:53 am

TheRocK wrote: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

TheRocK
Posts: 20
Joined: Sun Jan 18, 2009 4:18 am

Re: Standardised Coefficients

Postby TheRocK » Sat May 23, 2009 8:04 am

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

TheRocK
Posts: 20
Joined: Sun Jan 18, 2009 4:18 am

Re: Standardised Coefficients

Postby TheRocK » Sun May 24, 2009 1:35 am

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

TheRocK
Posts: 20
Joined: Sun Jan 18, 2009 4:18 am

Re: Standardised Coefficients

Postby TheRocK » Tue May 26, 2009 1:10 pm

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

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

Re: Standardised Coefficients

Postby EViews Gareth » Tue May 26, 2009 1:36 pm

Could you post your workfile, and your program so far....
Follow us on Twitter @IHSEViews

TheRocK
Posts: 20
Joined: Sun Jan 18, 2009 4:18 am

Re: Standardised Coefficients

Postby TheRocK » Tue May 26, 2009 11:57 pm

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

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

Re: Standardised Coefficients

Postby EViews Gareth » Wed May 27, 2009 8:04 am

Follow us on Twitter @IHSEViews


Return to “Program Repository”

Who is online

Users browsing this forum: No registered users and 7 guests