Moving standard deviation

1

Dear Miss SAS Answers,

I am having a tough time developing SAS code to determine volatility ( i.e.: the moving standard deviation using GARCH approach). I need a conditional volatility measure of exchange rate from past 40 years. I have data from the past 50 years, and I would like to determine volatility using previous 10 years' real exchange rate. Could you please help me?

Sincerely,

Mercurial Mike

Dear Mike,

I have to admit that you totally lost me after the first occurence of the word "volatility".  Fortunately for both of us, I have some very smart statistical friends. :-)  Dr. Bob Lucas sent the following to educate us both:

PROC AUTOREG in SAS/ETS can be used to estimate GARCH models. PROC EXPAND in SAS/ETS calculates many moving summary statistics including the option CMOVSTD, which stands for Centered MOVing Standard Deviation. The user can specify the width of the window over which the statistic is calculated.

From the SAS/ETS documentation:

 Moving Time Window Operators

Some operators compute statistics for a set of values within a moving time window; these are called moving time window operators. There are centered and backward versions of these operators.

The centered moving time window operators are CMOVAVE, CMOVCSS, CMOVGMEAN, CMOVMAX, CMOVMED, CMOVMIN, CMOVPROD, CMOVRANGE, CMOVRANK, CMOVSTD, CMOVSUM, CMOVTVALUE, CMOVUSS, and CMOVVAR. These operators compute statistics of the values for observations

The backward moving time window operators are MOVAVE, MOVCSS, MOVGMEAN, MOVMAX, MOVMED, MOVMIN, MOVPROD, MOVRANGE, MOVRANK, MOVSTD, MOVSUM, MOVTVALUE, MOVUSS, and MOVVAR. These operators compute statistics of the values .

All the moving time window operators accept an argument specifying the number of periods to include in the time window. For example, the following statement computes a five-period backward moving average of X.

     convert x=y / transformout=( movave 5 );

In this example, the resulting transformation is

     yt = (xt + xt-1 + xt-2 + xt-3 + xt-4) / 5

The following statement computes a five-period centered moving average of X.

     convert x=y / transformout=( cmovave 5 );

In this example, the resulting transformation is

     yt = (xt-2 xt-1 + x + xt+1 xt+2) / 5

It sounds to me like SAS/ETS with PROC AUTOREG or PROC EXPAND might be just what you're looking for.  (Remember, I'm an English major.  However, Dr. Lucas is a statistical whiz, so following his advice on forecasting is probably a pretty good bet.)

I hope this helps solve your estimating/forecasting dilemna.  If you are interested in SAS/ETS training, our Forecasting Using SAS Software: A Programming Approach course (taught by forecasting experts) is offered in both our traditional classroom setting and via Live Web.

Happy forecasting,

Miss SAS Answers

Share

About Author

Miss SAS Answers

Technical Training Specialist

Linda Jolley has been a SAS software user since 1980. She has been an instructor for SAS since 1997, and is Base and Advanced SAS Programming certified and working on the Data Integration Developer certification. She has presented papers at several SAS user group venues on various SAS programming efficiency techniques and the SAS Scalable Performance Data Server.

1 Comment

Back to Top