1
$\begingroup$

I am trying to remove the volatility of my sample time series by fitting the GARCH(1,1) model with Gaussian innovations.The time series I use is the log returns on the daily closing value of S&P 500. My code and result are following:

>library(fGarch)
>fit <- garchFit(~garch(1,1),dataex0[,8])
Series Initialization:
 ARMA Model:                arma
 Formula Mean:              ~ arma(0, 0)
 GARCH Model:               garch
 Formula Variance:          ~ garch(1, 1)
 ARMA Order:                0 0
 Max ARMA Order:            0
 GARCH Order:               1 1
 Max GARCH Order:           1
 Maximum Order:             1
 Conditional Dist:          norm
 h.start:                   2
 llh.start:                 1
 Length of Series:          2000
 Recursion Init:            mci
 Series Scale:              0.006069538

Parameter Initialization:
 Initial Parameters:          $params
     Limits of Transformations:   $U, $V
     Which Parameters are Fixed?  $includes
 Parameter Matrix:
                     U            V      params includes
    mu     -0.06312614   0.06312614 0.006312614     TRUE
    omega   0.00000100 100.00000000 0.100000000     TRUE
    alpha1  0.00000001   0.99999999 0.100000000     TRUE
    gamma1 -0.99999999   0.99999999 0.100000000    FALSE
    beta1   0.00000001   0.99999999 0.800000000     TRUE
    delta   0.00000000   2.00000000 2.000000000    FALSE
    skew    0.10000000  10.00000000 1.000000000    FALSE
    shape   1.00000000  10.00000000 4.000000000    FALSE
 Index List of Parameters to be Optimized:
    mu  omega alpha1  beta1 
     1      2      3      5 
 Persistence:                  0.9 


--- START OF TRACE ---
Selected Algorithm: nlminb 

R coded nlminb Solver: 

  0:     2394.8329: 0.00631261 0.100000 0.100000 0.800000
  1:     2329.7128: 0.00631265 0.0728589 0.0996003 0.787463
  2:     2291.6739: 0.00631273 0.0452698 0.111111 0.786880
  3:     2270.1297: 0.00631285 0.0437594 0.134625 0.805286
  4:     2256.8989: 0.00631289 0.0323087 0.134800 0.804261
  5:     2248.6049: 0.00631328 0.00851570 0.159633 0.834797
  6:     2243.1173: 0.00632067 0.0183460 0.127276 0.865946
  7:     2228.3633: 0.00632407 0.00946190 0.0909932 0.892770
  8:     2228.3338: 0.00632795 0.0105822 0.0976829 0.888280
  9:     2228.3193: 0.00634008 0.00964861 0.100148 0.885832
 10:     2228.1584: 0.00634353 0.00995426 0.0989131 0.887329
 11:     2228.0474: 0.00635010 0.00912754 0.0965276 0.890359
 12:     2228.0031: 0.00636110 0.00959119 0.0943452 0.892300
 13:     2227.9669: 0.00638262 0.00926070 0.0941498 0.892455
 14:     2227.9518: 0.00642400 0.00933310 0.0959777 0.891553
 15:     2227.9160: 0.00651023 0.00902408 0.0949798 0.892492
 16:     2227.8869: 0.00659592 0.00909298 0.0935140 0.893974
 17:     2227.8679: 0.00668258 0.00889816 0.0933351 0.894164
 18:     2227.6942: 0.00855821 0.00892415 0.0988714 0.890168
 19:     2225.8979: 0.0308771 0.00756293 0.0922355 0.899421
 20:     2225.6739: 0.0393438 0.00972994 0.0965558 0.889394
 21:     2225.5372: 0.0358219 0.00902244 0.0950297 0.892916
 22:     2225.5359: 0.0357989 0.00891981 0.0947544 0.893400
 23:     2225.5359: 0.0358137 0.00892470 0.0947669 0.893375
 24:     2225.5359: 0.0358141 0.00892466 0.0947667 0.893376

Final Estimate of the Negative LLH:
 LLH:  -7983.41    norm LLH:  -3.991705 
          mu        omega       alpha1        beta1 
2.173752e-04 3.287782e-07 9.476673e-02 8.933757e-01 

R-optimhess Difference Approximated Hessian Matrix:
                  mu         omega        alpha1         beta1
mu     -149385552.74  5.663613e+09  3.364408e+04 -1.849870e+04
omega  5663613236.93 -6.478620e+14 -4.535166e+09 -6.800991e+09
alpha1      33644.08 -4.535166e+09 -7.151621e+04 -8.188082e+04
beta1      -18498.70 -6.800991e+09 -8.188082e+04 -1.089963e+05
attr(,"time")
Time difference of 0.03100204 secs

--- END OF TRACE ---


Time to Estimate Parameters:
 Time difference of 0.1548059 secs
> res<-residuals(fit)
> head(res)
[1] -0.0050919672  0.0023355948 -0.0003280802  0.0015576128
[5]  0.0001095798 -0.0017182582
> fitvalue<-fitted(fit)
> head(fitvalue)
           1            2            3            4 
-0.004874592  0.002552970 -0.000110705  0.001774988 
           5            6 
 0.000326955 -0.001500883 
> head(dataex0[,8])
[1] -0.004874592  0.002552970 -0.000110705  0.001774988
[5]  0.000326955 -0.001500883


>fittedvalue<-fit@fitted
> head(fittedvalue)
   1        2        3        4        5        6 
 1274.351 1274.351 1274.351 1274.351 1274.351 1274.351 

Is my code wrong? Why the fitted value is exactly the same as the original data? I also tried fit@fitted at the end, but the output is different but repeating one value.

$\endgroup$
  • $\begingroup$ I also tried fit@fitted at the end, but the output is different but repeating one value.: the conditional mean is constant in your model (ARMA order is (0,0)), so the outcome is not surprising. $\endgroup$ – Richard Hardy Aug 12 '15 at 14:20
  • $\begingroup$ Do you know why the fitted value is the same as original data?@RichardHardy $\endgroup$ – NANA Aug 12 '15 at 14:25
  • $\begingroup$ Are you sure that you are extracting the right objects from fit, and what those object actually mean? I do not use this package, so I am not familiar with the details. $\endgroup$ – Richard Hardy Aug 12 '15 at 14:27
  • $\begingroup$ As I know the function fitted is used to fitted extracts fitted values from a fitted ’fGARCH’ object. I tried this using different data, the result was the same. So I am not sure now. Thank you for your help. @RichardHardy $\endgroup$ – NANA Aug 12 '15 at 14:37
  • $\begingroup$ I will try to look at it later, but I cannot promise anything. I will let you know if I find anything out. $\endgroup$ – Richard Hardy Aug 12 '15 at 14:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.