Error sample: range error
Posted: Thu Apr 21, 2011 8:13 am
Hi!
I'm having trouble with a range error that occurs after running my program that tries to simulate ARCH.
Somehow I'm not rightly specifying the argument in the @inner-command. What I want is the inner product of the single elements of the series I'm multiplying.
This is probably (and hopefully) an easy problem to solve, but I'm just a dummy in programming.
Could anybody help me?
This is the program:
'ARCHbegin.prg
workfile c:\ectr3\archopzet.wf1 u 1 100
!R=100
!alpha0=1
!alpha1=0.5
!beta1=1
!beta2=1
!sigmax=2
smpl 1 1
genr eps=0
smpl 2 100
matrix (!R,2) simres
for !rep=1 to !R
genr u= nrnd
genr etha=rnd
genr o2= !alpha0 + !alpha1*(eps(-1)^2) + etha 'specifying the ARCH(1)-process
genr o=@sqrt(o2)
genr eps= @inner(u,o, !rep !rep)
genr x= nrnd*!sigmax
genr y= !beta1 + !beta2*x + eps
equation eq1.ls y c x
simres(!rep,1)=eq1.@coefs(1)
simres(!rep,2)=eq1.@coefs(2)
next
Many thanks in advance,
Casper
I'm having trouble with a range error that occurs after running my program that tries to simulate ARCH.
Somehow I'm not rightly specifying the argument in the @inner-command. What I want is the inner product of the single elements of the series I'm multiplying.
This is probably (and hopefully) an easy problem to solve, but I'm just a dummy in programming.
Could anybody help me?
This is the program:
'ARCHbegin.prg
workfile c:\ectr3\archopzet.wf1 u 1 100
!R=100
!alpha0=1
!alpha1=0.5
!beta1=1
!beta2=1
!sigmax=2
smpl 1 1
genr eps=0
smpl 2 100
matrix (!R,2) simres
for !rep=1 to !R
genr u= nrnd
genr etha=rnd
genr o2= !alpha0 + !alpha1*(eps(-1)^2) + etha 'specifying the ARCH(1)-process
genr o=@sqrt(o2)
genr eps= @inner(u,o, !rep !rep)
genr x= nrnd*!sigmax
genr y= !beta1 + !beta2*x + eps
equation eq1.ls y c x
simres(!rep,1)=eq1.@coefs(1)
simres(!rep,2)=eq1.@coefs(2)
next
Many thanks in advance,
Casper