Error @rapplyranks for different samples

For questions regarding programming in the EViews programming language.

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

crinuska
Posts: 3
Joined: Fri Jun 17, 2011 2:24 am

Error @rapplyranks for different samples

Postby crinuska » Fri Jun 17, 2011 2:37 am

The following programme works only for some subsamples in our period, for example 2001-2002. For other samples we have the following error: Invalid permutation index vector in "MATRIX ORDONATE=@RAPPLYRANKS(COMPAV,RANK_BETA)".

Does anyone know how to help? Thanks.

scalar k=0
for !i=1 to 1127
smpl @first @last
vector v!i= @columnextract(germany,!i)
series s!i
series returns!i
mtos(v!i,s!i)
returns!i = s!i -rate_ger
rowvector(1127) betas

smpl 1/01/2001 1/01/2002
if @obs(returns!i) >125 then
k=k+1

equation regresie.ls (returns!i) c (msci_ger-rate_ger)
rowvector(k) betasort
betasort(k)=regresie.@coefs(2)
matrix(@obsrange,k) compav
colplace(compav,returns!i,k)
endif

delete returns!i

delete s!i
delete v!i
next


smpl @first @last
matrix(4435,k) new_ordonare
matplace(new_ordonare,compav)
rowplace(new_ordonare,betasort,4435)
rowvector rank_beta=@ranks(@rowextract(new_ordonare,4435),"a")
matrix ordonate=@rapplyranks(compav,rank_beta)

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

Re: Error @rapplyranks for different samples

Postby EViews Gareth » Fri Jun 17, 2011 7:52 am

@rapplyranks isn't sample based, so it is difficult to know what is causing the error.

crinuska
Posts: 3
Joined: Fri Jun 17, 2011 2:24 am

Re: Error @rapplyranks for different samples

Postby crinuska » Sat Jun 18, 2011 3:49 am

Thanks for your prompt reply. I have attached the workfile I on on.(due to the size limit of 2 mb, I have created and attached several archives.). I will post the program again, with a sample that gives that error. The program creates and fills the matrix of companies available, the matrix including the rowvector that we want to use for sorting, however it gives the error when it comes to the @rapplyranks line. As I previously mentioned, this program works well for some subsamples, for example, 1/01/2001 1/01/2002. Could you please take a look at the workfile and program and maybe tell me what am I doing wrong. Thank you!

scalar k=0
for !i=1 to 1127
smpl @first @last
vector v!i= @columnextract(germany,!i)
series s!i
series returns!i
mtos(v!i,s!i)
returns!i = s!i -rate_ger
rowvector(1127) betas

smpl 1/03/1994 1/02/1995
if @obs(returns!i) >125 then
k=k+1

equation regresie.ls (returns!i) c (msci_ger-rate_ger)
rowvector(k) betasort
betasort(k)=regresie.@coefs(2)
matrix(@obsrange,k) compav
colplace(compav,returns!i,k)
endif

delete returns!i

delete s!i
delete v!i
next


smpl @first @last
matrix(4435,k) new_ordonare
matplace(new_ordonare,compav)
rowplace(new_ordonare,betasort,4435)
rowvector rank_beta=@ranks(@rowextract(new_ordonare,4435),"a")
matrix ordonate=@rapplyranks(compav,rank_beta)
Attachments
germ.part03.rar
(1.91 MiB) Downloaded 193 times
germ.part02.rar
(1.91 MiB) Downloaded 198 times
germ.part01.rar
the workfile
(1.39 MiB) Downloaded 200 times

crinuska
Posts: 3
Joined: Fri Jun 17, 2011 2:24 am

Re: Error @rapplyranks for different samples

Postby crinuska » Sat Jun 18, 2011 3:51 am

I have attached here the rest of the archives from the workfile.
Attachments
germ.part05.rar
(711.6 KiB) Downloaded 189 times
germ.part04.rar
(1.91 MiB) Downloaded 199 times

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

Re: Error @rapplyranks for different samples

Postby EViews Gareth » Sat Jun 18, 2011 3:17 pm

As I suspected, it has nothing to do with the sample.

For the iteration that is causing the error, your ranks vector, rank_betas has three values that are identical. Thus it cannot be used to apply ranks, since each value in the ranking vector has to be a unique integer.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 1 guest