Page 1 of 1

question about matrix code

Posted: Sun May 15, 2016 1:47 pm
by Cane
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!

Re: question about matrix code

Posted: Sun May 15, 2016 1:55 pm
by EViews Gareth
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

Re: question about matrix code

Posted: Mon May 16, 2016 2:40 am
by Cane
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!

Re: question about matrix code

Posted: Mon May 16, 2016 4:04 am
by Cane
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?

Re: question about matrix code

Posted: Mon May 16, 2016 4:08 am
by EViews Gareth
Nothing wrong that code that I can see - runs fine for me.