I have a matrix with 100 rows and 100 column: M(100,100).
I need to construct two matrices one with the odd rows and with the even rows: M_odd(50,50 and M_even(50,50)
I have extracted the raws using the following loop
for !i =1 to 100
rowvector r!i = @rowextract(M,!i)
next
How can I construct the two matrices with a loop in order to avoid to following manual approach?
EVEN rows
rowplace(M_even,r1,1)
rowplace(M_even,r3,2)
etc...
ODD rows
rowplace(M_odd,r2,1)
rowplace(M_odd,r4,2)
etc...
Constracting two matrices with odd and even rows
Moderators: EViews Gareth, EViews Moderator
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13319
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Constracting two matrices with odd and even rows
Code: Select all
create u 10
matrix(100,100) m
rnd(m)
vector(50) v_odd
vector(50) v_even
for !i=1 to 50
v_odd(!i) = !i*2-1
v_even(!i) = !i*2
next
matrix m_odd = m.@row(v_odd)
matrix m_even = m.@row(v_even)
Follow us on Twitter @IHSEViews
Re: Constracting two matrices with odd and even rows
I get the following error message
non numeric argment v_odd in "matrix m_odd = m.@row(v_odd)"
non numeric argment v_odd in "matrix m_odd = m.@row(v_odd)"
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13319
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Constracting two matrices with odd and even rows
Which version of EViews?
Follow us on Twitter @IHSEViews
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13319
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Constracting two matrices with odd and even rows
You'll need EViews 8.
Follow us on Twitter @IHSEViews
Re: Constracting two matrices with odd and even rows
do you have another suggestion which runs in Eviews 7.2?
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13319
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Constracting two matrices with odd and even rows
You'll have to do the rowplace in a loop.
Follow us on Twitter @IHSEViews
Return to “General Information and Tips and Tricks”
Who is online
Users browsing this forum: No registered users and 20 guests