Page 1 of 1

Rolling VaR estimates

Posted: Sun Aug 11, 2013 7:51 am
by Stu
.

Re: Rolling VaR estimates

Posted: Sun Aug 11, 2013 4:16 pm
by Stu

Re: Rolling VaR estimates

Posted: Mon Aug 12, 2013 2:30 am
by trubador
Suppose you have a return series called rt. Then, for EWMA you can try:

Code: Select all

!alpha = 0.02 'you should provide an appropriate value for this parameter smooth(s,!alpha) rt^2 ewma
And as for GJR with t-distribution:

Code: Select all

arch(1,1,thrsh=1,tdist) rt c
Finally, to obtain the lower %1 quantile of a series y:

Code: Select all

scalar q1 = @quantile(y,0.01)
Please note that, all these commands (and many more) are available in the users guide.

Re: Rolling VaR estimates

Posted: Mon Aug 12, 2013 7:25 am
by Stu
.

Re: Rolling VaR estimates

Posted: Mon Aug 12, 2013 8:34 am
by Stu
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.

Re: Rolling VaR estimates

Posted: Mon Aug 12, 2013 9:40 am
by Stu

Re: Rolling VaR estimates

Posted: Mon Aug 12, 2013 9:51 am
by Stu

Re: Rolling VaR estimates

Posted: Mon Aug 12, 2013 10:41 am
by EViews Gareth

Code: Select all

%smpl = @str(!i) + " 1250" scalar x = @elem(ewma, %smpl)

Re: Rolling VaR estimates

Posted: Mon Aug 12, 2013 11:05 am
by Stu
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?

Re: Rolling VaR estimates

Posted: Mon Aug 12, 2013 11:07 am
by EViews Gareth
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.

Re: Rolling VaR estimates

Posted: Mon Aug 12, 2013 11:13 am
by Stu

Re: Rolling VaR estimates

Posted: Mon Aug 12, 2013 12:51 pm
by Stu

Re: Rolling VaR estimates

Posted: Mon Aug 12, 2013 1:04 pm
by EViews Gareth

Code: Select all

scalar x = @elem(ewma, "1251")

Re: Rolling VaR estimates

Posted: Mon Aug 12, 2013 1:13 pm
by Stu
.

Re: Rolling VaR estimates

Posted: Tue Aug 13, 2013 1:23 am
by trubador
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