Hi,
I am estimating G regressions and storing a scalar from each regression in a row vector and a computed data series (nobs x 1) in each column of a matrix. Upon completion, I have a (Gx1) row vector and a (nobs X G) matrix. Later in the program, I multiply the (matrix * row vector). No problem.
For a few iterations, the computed series cannot be calculated so the column that is placed in the matrix has NAs. Needless to say, the computation of the (matrix * row vector) fails when this happens.
Is there a way that I could: (a) check for NAs in the (nobs x G) matrix when all of the iterations are completed and (b) delete the corresponding columns in the matrix and rows in the row vector for which NAs appear?
Thanks for your help.
Deleting a column from a matrix (and a row from a vector)
Moderators: EViews Gareth, EViews Steve, EViews Moderator, EViews Jason
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Deleting a column from a matrix (and a row from a vector
Not easy to do either.
Perhaps the best way to check for NAs is to check that each column has the same number of observations. You can use @cobs to do that. If you know how many observations should be in each column, you could just check whether the mimimum of @cobs is equal to the proper number.
In EViews 8 the best way to delete rows/columns from a matrix is to use the @droprow data member of a matrix.
Perhaps the best way to check for NAs is to check that each column has the same number of observations. You can use @cobs to do that. If you know how many observations should be in each column, you could just check whether the mimimum of @cobs is equal to the proper number.
In EViews 8 the best way to delete rows/columns from a matrix is to use the @droprow data member of a matrix.
Re: Deleting a column from a matrix (and a row from a vector
Thanks. I'll play around with your suggested approach.
Would this alternative approach be feasible?
Will EViews allow you to expand a matrix dynamically? For instance, I could create and initial column vector (of 0's or something) and then concatenate a new column if that column does not contain NAs. This would yield a final matrix of only numerical values.
Would this alternative approach be feasible?
Will EViews allow you to expand a matrix dynamically? For instance, I could create and initial column vector (of 0's or something) and then concatenate a new column if that column does not contain NAs. This would yield a final matrix of only numerical values.
Re: Deleting a column from a matrix (and a row from a vector
Thanks. I'll play around with your suggested approach.
Would this alternative approach be feasible?
Will EViews allow you to expand a matrix dynamically? For instance, I could create and initial column vector (of 0's or something) and then concatenate a new column if that column does not contain NAs. This would yield a final matrix of only numerical values.
Would this alternative approach be feasible?
Will EViews allow you to expand a matrix dynamically? For instance, I could create and initial column vector (of 0's or something) and then concatenate a new column if that column does not contain NAs. This would yield a final matrix of only numerical values.
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Deleting a column from a matrix (and a row from a vector
There's a @hcat function that will concatenate.
Who is online
Users browsing this forum: No registered users and 2 guests
