Rolling VaR estimates
Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt
Re: Rolling VaR estimates
Suppose you have a return series called rt. Then, for EWMA you can try:
And as for GJR with t-distribution:
Finally, to obtain the lower %1 quantile of a series y:
Please note that, all these commands (and many more) are available in the users guide.
Code: Select all
!alpha = 0.02 'you should provide an appropriate value for this parameter
smooth(s,!alpha) rt^2 ewma
Code: Select all
arch(1,1,thrsh=1,tdist) rt c
Code: Select all
scalar q1 = @quantile(y,0.01)
Re: Rolling VaR estimates
I run the programs, but it keeps showing up error messages. And have tried to adpat the codes, but couldnt figure out what the problem is!!
Could someone please help, by perhaps even giving some hints at the problems? I very much appreciate your time!
Thanks.
Could someone please help, by perhaps even giving some hints at the problems? I very much appreciate your time!
Thanks.
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13366
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Rolling VaR estimates
Code: Select all
%smpl = @str(!i) + " 1250"
scalar x = @elem(ewma, %smpl)
Follow us on Twitter @IHSEViews
Re: Rolling VaR estimates
Gareth,
When i run it, it shows up 'Illegal date 1 1250 in “scalar x = @elem(ewma, "1 1250")"
What could be the problem here?
When i run it, it shows up 'Illegal date 1 1250 in “scalar x = @elem(ewma, "1 1250")"
What could be the problem here?
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13366
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Rolling VaR estimates
Sorry, I posted without thinking.
I don't understand what you're trying to do with that line. @elem takes a single date, not a range of dates.
I don't understand what you're trying to do with that line. @elem takes a single date, not a range of dates.
Follow us on Twitter @IHSEViews
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13366
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Rolling VaR estimates
Code: Select all
scalar x = @elem(ewma, "1251")
Follow us on Twitter @IHSEViews
Re: Rolling VaR estimates
I tried to modify your code so as to perform what you want and to give you the idea for further adjustments. However, I suggest you to go over An Introduction to Eviews Programming before moving forward.
Code: Select all
!window = 1250
!length = @obsrange
!alpha = 1-0.94 '1-alpha is the coefficient of estimated variance
!scale = 10000 'it might be a good idea to adjust the scale
series x 'create the output series beforehand
matrix(!window,!length) results 'you can create a matrix to store all the resulting smoothed series
' move sample !step obs at a time
for !i = 1 to !length-!window
smpl @first+!i-1 @first+!i+!window-2
smooth(s,!alpha) !scale*returns^2 ewma
stom(ewma,ewmat) 'convert series to a vector
colplace(results,ewmat,!i) 'place the vector into the matrix
x(!window+!i) = ewma(!window+!i)
next
smpl @all
Who is online
Users browsing this forum: Ahrefs [Bot] and 2 guests