Hi,
I would like to produce a TxN matrix from a set of N individual series. The issue is that there are time periods with NAs in each of the series. I want to keep track of the NAs in the matrix.
To solve the problem, I tried two possibilities (below), but neither worked. The output is a TxN matrix pricesmat. The individual series with the NAs are stored as subcomp{!j}_pc, where j=1,...,N indexes each individual series.
Thank you.
ATTEMPT 1. Error is 'Pricesmat(T,1) is an illegal or reserved name'
matrix(T,N) pricesmat = @zeros(T,N)
for !j = 1 to N
stomna(subcomp{!j}_pc,pricesmat(T,!j))
next
ATTEMPT 2. Error is 'Nonumeric argument in subcomp1_v'
matrix(T,N) pricesmat = @zeros(T,N)
for !j = 1 to N
vector(T) subcomp{!j}_v
stomna(subcomp{!j}_pc,subcomp{!j}_v)
pricesmat(T,!j) = subcomp{!j}_v
next
Matrix with NAs
Moderators: EViews Gareth, EViews Jason, EViews Moderator, EViews Matt
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13315
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Matrix with NAs
Attempt 2 is the way to go.
I'm not sure what
is meant to be doing, but you probably want to use the colplace function.
I'm not sure what
Code: Select all
pricesmat(T,!j) = subcomp{!j}_v
is meant to be doing, but you probably want to use the colplace function.
Follow us on Twitter @IHSEViews
Re: Matrix with NAs
Thanks, Gareth. This line
pricesmat(T,!j) = subcomp{!j}_v
was supposed to replace each of the j=1,...,N columns with the j=1,...,N series, but that appears to be the source of the error.
After I sent the email, I remembered the colplace command and modified the loop, but I still get an error message. Here is the modified loop:
matrix(T,N) pricesmat = @zeros(T,N)
for !j = 1 to N
vector(T) subcomp{!j}_v
stomna(subcomp{!j}_pc,subcomp{!j}_v)
colplace(pricesmat(T,!j), subcomp{!j}_v, !j)
next
The error message I now get is: Scalar "" sent to a function which is expecting a matrix in "COLPLACE(PRICEMAT(T,1),SUBCOMP1_V,1)"
Thanks again for your help.
Ron
pricesmat(T,!j) = subcomp{!j}_v
was supposed to replace each of the j=1,...,N columns with the j=1,...,N series, but that appears to be the source of the error.
After I sent the email, I remembered the colplace command and modified the loop, but I still get an error message. Here is the modified loop:
matrix(T,N) pricesmat = @zeros(T,N)
for !j = 1 to N
vector(T) subcomp{!j}_v
stomna(subcomp{!j}_pc,subcomp{!j}_v)
colplace(pricesmat(T,!j), subcomp{!j}_v, !j)
next
The error message I now get is: Scalar "" sent to a function which is expecting a matrix in "COLPLACE(PRICEMAT(T,1),SUBCOMP1_V,1)"
Thanks again for your help.
Ron
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13315
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Matrix with NAs
Thank you, Gareth. Boneheaded error on my part.
Ron
Ron
Who is online
Users browsing this forum: No registered users and 24 guests