delete rows from matrix

For questions regarding programming in the EViews programming language.

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

iris
Posts: 3
Joined: Mon Sep 29, 2014 12:08 am

delete rows from matrix

Postby iris » Mon Sep 29, 2014 8:36 am

Hi everybody!

I use Eviews 7. I would like to delete some rows from a matrix. To be more specific I would like to delete a row if the number of zero elements in the row is more than 90% of the number of elements in the row. In other words if zero elements are more than a specific number. It seems an easy problem but I am confused with the programming language and yet I don't know if it is possible to delete rows from a matrix. I tried to delete the rows manually from a group that has the same dimensions and elements with the matrix but it kept the date on the left (it warned that it was going to do so anyway).

Regards,
Iris

EViews Glenn
EViews Developer
Posts: 2682
Joined: Wed Oct 15, 2008 9:17 am

Re: delete rows from matrix

Postby EViews Glenn » Mon Sep 29, 2014 9:29 am

Before discussing the programming question it might be useful if you describe what it is you are trying to do. "Deleting" rows from a matrix isn't easy, but I bet an operation that more readily gets you to where you want to go.

iris
Posts: 3
Joined: Mon Sep 29, 2014 12:08 am

Re: delete rows from matrix

Postby iris » Mon Sep 29, 2014 10:10 am

Thank you for your reply!
I'll try to describe what I am trying to do as precisely as I can.
I have a matrix(3830,74). Some of its rows contain zeros. The maximum number of zeros is 74 for some rows.
I know because I converted the matrix to a group and then used the the @rvalcount(group,0) function to count the zeros in each row.
I want to find the rows that contain more than 90%*74 zeros and delete them.

EViews Glenn
EViews Developer
Posts: 2682
Joined: Wed Oct 15, 2008 9:17 am

Re: delete rows from matrix

Postby EViews Glenn » Mon Sep 29, 2014 3:27 pm

What I wanted to know is what you want to do with the matrix when you are done as there may be other ways of representing the data. But beyond that, since you've already converted the matrix to a group, why not set the sample to exclude obs using the @rvalcount and then convert back to a matrix.

iris
Posts: 3
Joined: Mon Sep 29, 2014 12:08 am

Re: delete rows from matrix

Postby iris » Tue Sep 30, 2014 12:02 pm

I would use that matrix to run another program. Yes, you' re right!
Thank you very much for your help!


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests