[R-SIG-Finance] Preparing data for Superior predictive ability (SPA) test
Karthik Raju
commons.r at karthik.in
Sat Nov 29 04:44:45 CET 2014
Hello Brain,
Thank you for your response.
I will explain my work with an example.
- I have logarithmic returns computed from daily closing values of a
stock market index for a period of 500 days.
- The logarithmic returns are used in the "rugarch" package to fit the
following models,
Model-1 - GARCH (1,1)
Model-2 - GJR-GARCH (1,1)
Model-3 - EGARCH (1,1)
Model-4 - IGARCH (1,1)
Model-5 - APARCH (1,1)
- Then, using "rugarch", forecasted one step ahead volatility with each
of the above model parameters for an out-of-sample period of 100 days.
- The forecasted 100 days "sigma" values of each model is extracted from
R to a worksheet and used against true volatility proxy to compute the
loss functions.
- The structure of loss function data for each model is an univariate
series for the forecasted period (100 days).
- For example, the structure of Mean Square Error (MSE) loss function
looks like,
Forecasts MSE_GARCH MSE_GJR . . MSE_APARCH
Day 1 0.008548 0.005509 . . 0.00412
Day 2 0.008655 0.005498 . . 0.00414
Day 3 0.008759 0.005488 . . 0.004156
Day 4 0.008861 0.005478 . . 0.004169
. . . . . .
. . . . . .
. . . . . .
Day 99 0.008759 0.005488 . . 0.004156
Day 100 0.008861 0.005478 . . 0.004169
- Similarly, the loss functions like Mean Absolute Error, Mean Absolute
Percentage Error etc. are in the same structure, which are then imported
into R.
- Now, by using each of this loss function data series, one at a time,
in the "ttrTests" package, I want to know how to compute the SPA test
for the following combinations?
Benchmark model GARCH (1,1) Vs rest of 4 models
Benchmark model GJR GARCH (1,1) Vs rest of 4 models
Benchmark model EGARCH (1,1) Vs rest of 4 models
Benchmark model IGARCH (1,1) Vs rest of 4 models
Benchmark model APARCH (1,1) Vs rest of 4 models
Best,
Karthik
> Please follow the posting guide
>
> http://www.r-project.org/posting-guide.html
>
> and provide a reproducible example. For instance, you could repeat your
> 'n' samples using some of the test data from rugarch.
>
> It is very difficult for others to help you if we don't know the format
> your data is in *now*.
>
> Regards,
>
> Brian
>> On 11/27/2014 11:24 PM, Karthik Raju wrote:
>>
>> Hello,
>>
>> Can anyone please let me know how to prepare data to compute Superior
>> predictive ability (SPA) test in R?
>>
>> I am working on forecasting volatility in stock markets, the context is,
>>
>> 1) I used "rugarch" package to forecast the volatility using "n"
>> autoregressive models.
>>
>> 3) Extracted "sigma" values from the forecasts of those "n" models and
>> used it in a worksheet against realized volatility to calculate daily
>> loss functions for each model, say, MSE, MAE, RMSE etc.
>>
>> 3) I want to compute the SPA test statistics using "ttrTests" package
>> and find the SPA test p-values for a benchmark model against "n"
>> alternatives. How to prepare data for this purpose?
>>
>> Thanks,
>> Karthik
More information about the R-SIG-Finance
mailing list