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
Error sample: range error
Moderators: EViews Gareth, EViews Jason, EViews Moderator, EViews Matt
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13323
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Error sample: range error
Code: Select all
%smpl = @str(!rep) + " " + @str(!rep)
genr eps= @inner(u,o, %smpl)
Follow us on Twitter @IHSEViews
Re: Error sample: range error
Thanks!
The program doesn't give any error now anymore
However the 100 values for 'eps' are all the same, namely the inner product of the last two values for u and o:
...
obs 95 1.43377935715309
obs 96 1.43377935715309
obs 97 1.43377935715309
obs 98 1.43377935715309
obs 99 1.43377935715309
obs 100 1.43377935715309
What I was actually after, was 100 different values for 'eps', namely the inner product of the first elements of u and o, then the inner product of the second elements of u and o, and so on... You would say that would automatically happen since it's in the generated in the loop right?
Many thanks,
Casper
The program doesn't give any error now anymore
However the 100 values for 'eps' are all the same, namely the inner product of the last two values for u and o:
...
obs 95 1.43377935715309
obs 96 1.43377935715309
obs 97 1.43377935715309
obs 98 1.43377935715309
obs 99 1.43377935715309
obs 100 1.43377935715309
What I was actually after, was 100 different values for 'eps', namely the inner product of the first elements of u and o, then the inner product of the second elements of u and o, and so on... You would say that would automatically happen since it's in the generated in the loop right?
Many thanks,
Casper
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13323
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Error sample: range error
You're over-writing all observations of eps every time you go through the loop. You might want to set the workfile sample so that you only assign to whatever observations you want.
Follow us on Twitter @IHSEViews
Re: Error sample: range error
Ah I see.
Thanks for the help.
Thanks for the help.
Re: Error sample: range error
Hi,
I have a panel data with observations for 1960, 1970, 1980, 1990, 2000, 2010 and 2015. That is, my data goes every 10 years except of the last observation. I estimated my models in two different manners: 1) using smpl 1960 2010; and 2) using smpl 1960 2015.
The aim of my program is to forecast from 2020 to 2050, every 10 years. I want to do so using the two different models I have set above. If I choose the decennial sample 1960 2010 and forecast based on that estimation, that's done correctly. The problem is when I include 2015 in the sample. I'm unable to create a page with 2015, 2020, 2030, 2040 and 2050. This is because 2015 is not following the same frequency. When I try to first create a range of 2020 to 2050 every ten years and then try to append data for 2015, I get the "error sample: range error".
Any assistance would be greatly appreciated.
Thanks.
I have a panel data with observations for 1960, 1970, 1980, 1990, 2000, 2010 and 2015. That is, my data goes every 10 years except of the last observation. I estimated my models in two different manners: 1) using smpl 1960 2010; and 2) using smpl 1960 2015.
The aim of my program is to forecast from 2020 to 2050, every 10 years. I want to do so using the two different models I have set above. If I choose the decennial sample 1960 2010 and forecast based on that estimation, that's done correctly. The problem is when I include 2015 in the sample. I'm unable to create a page with 2015, 2020, 2030, 2040 and 2050. This is because 2015 is not following the same frequency. When I try to first create a range of 2020 to 2050 every ten years and then try to append data for 2015, I get the "error sample: range error".
Any assistance would be greatly appreciated.
Thanks.
Who is online
Users browsing this forum: No registered users and 20 guests