question about matrix code

For questions regarding programming in the EViews programming language.

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

Cane
Posts: 5
Joined: Sun May 15, 2016 1:37 pm

question about matrix code

Postby Cane » Sun May 15, 2016 1:47 pm

Hi guys.
I want to make a matrix, but I have some problems. The code is as follows:

!imax = 5
matrix(!imax,!imax) amat = 0
for !i=1 to !imax
amat(!i,!i) = !i
next
!imax = 5
matrix(!imax,!imax) amat = 0
for !i=1 to !imax step = 2
amat(!i,!i) = !i
next


Soon the second line appears the error "!IMAX is not defined.", but I set in the previous line...

Thanks for the help!

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

Re: question about matrix code

Postby EViews Gareth » Sun May 15, 2016 1:55 pm

Did you run it as a program.

As an aside, the syntax for step is:

Code: Select all

for !i=1 to !imax step 2

Cane
Posts: 5
Joined: Sun May 15, 2016 1:37 pm

Re: question about matrix code

Postby Cane » Mon May 16, 2016 2:40 am

Did you run it as a program.

As an aside, the syntax for step is:

Code: Select all

for !i=1 to !imax step 2
Thanks! I´m yet a noob programming in Eviews.

I have other question. In this code:

!n = 6 workfile test u 1 !n
matrix(!n,2) x
x.fill 1.5, 0.7, 1, 2, 2.5, 3, 0.5, 2.2, 1.3, 1.7, 4, 3.5
vector(!n) y
y.fill 15, 17,18.2, 12.3, 13.4, 14
vector(3) beta
beta.fill 1, 0.5, 2
matrix u=@mnrnd(!n,1)
!mu_v = 4
!sigma_v = 2
matrix v=mu_v+sigma_v*@mnrnd(!n,1)

I have the error message:
SIGMA_V is not defined in "MATRIX V=MU_V+SIGMA_V*@MNRND(6,1)" Why? And now i ran as a program...

Thanks!

Cane
Posts: 5
Joined: Sun May 15, 2016 1:37 pm

Re: question about matrix code

Postby Cane » Mon May 16, 2016 4:04 am

Did you run it as a program.

As an aside, the syntax for step is:

Code: Select all

for !i=1 to !imax step 2
Thanks! I´m yet a noob programming in Eviews.

I have other question. In this code:

!n = 6 workfile test u 1 !n
matrix(!n,2) x
x.fill 1.5, 0.7, 1, 2, 2.5, 3, 0.5, 2.2, 1.3, 1.7, 4, 3.5
vector(!n) y
y.fill 15, 17,18.2, 12.3, 13.4, 14
vector(3) beta
beta.fill 1, 0.5, 2
matrix u=@mnrnd(!n,1)
!mu_v = 4
!sigma_v = 2
matrix v=mu_v+sigma_v*@mnrnd(!n,1)

I have the error message:
SIGMA_V is not defined in "MATRIX V=MU_V+SIGMA_V*@MNRND(6,1)" Why? And now i ran as a program...

Thanks!
Well, missed the "!"...

Another question, in the code of the first question:

!imax = 5
matrix(!imax,!imax) amat = 0
for !i=1 to !imax
amat(!i,!i) = !i
next
!imax = 5
matrix(!imax,!imax) amat = 0
for !i=1 to !imax step 2
amat(!i,!i) = !i
next

I have a syntax error in "AMAT(I!,I!)=1, why?

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

Re: question about matrix code

Postby EViews Gareth » Mon May 16, 2016 4:08 am

Nothing wrong that code that I can see - runs fine for me.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests