Please don't cross-post: https://mailman.stat.ethz.ch/pipermail/r-sig-finance/2011q3/008230.html -- Joshua Ulrich | FOSS Trading: www.fosstrading.com
On Wed, Jul 13, 2011 at 11:11 AM, Marcin P?�ciennik <puc...@gmail.com> wrote: > Dear list members, > > I am trying to estimate parameters of the AR(1)-GARCH(1,1) model. I have one > additional dummy variable for the AR(1) part. > First I wanted to do it using garchFit function (everything would be then > estimated in one step) however in the fGarch library I didn't find a way to > include an additional variable. > That would be the formula but, as said, I think it is impossible to add a > variable: > > garchFit(formula = ~ arma(1,0) + garch(1,1), data=x, include.mean=TRUE) > > > For that reason I decided to do everything in 2 steps. First I estimate the > AR parameters using arima function because here I can include additional > variable and then, in the second step, I estimate the GARCH part of the > model on the residuals from the AR model. > So, this is how I define the additional dummy variable: > > d<-rep(0,991) > for (i in 850:922) > d[i]<-1; > > and now the 2 steps: > > step1 = arima(x, order = c(1,0,0), xreg=d, include.mean = TRUE) > step2 = garch (step1$res, order = c(1,1), include.intercept = TRUE) > > > The argument 'xreg' apparently allows me to include another variable. > > At this point I wanted to ask you what do you think about the code. Do you > think everything is reasonable and correct? > > Ok. And now to the problem I encountered. > In the 2nd step, the program cannot finish the estimation. This is what it > shows: > > > ***** ESTIMATION WITH ANALYTICAL GRADIENT ***** > > > I INITIAL X(I) D(I) > > 1 4.747742e-04 1.000e+00 > 2 5.000000e-02 1.000e+00 > 3 5.000000e-02 1.000e+00 > > IT NF F RELDF PRELDF RELDX STPPAR D*STEP > NPRELDF > 0 1 -3.241e+03 > 1 9 -3.241e+03 6.72e-06 1.38e-05 4.7e-05 2.0e+09 4.7e-06 > 1.37e+04 > 2 16 -3.242e+03 8.84e-05 1.18e-04 1.3e-01 2.0e+00 1.6e-02 > 8.77e-02 > 3 20 -3.244e+03 6.76e-04 5.37e-04 6.9e-01 1.3e+00 2.6e-01 > 8.00e-03 > 4 22 -3.244e+03 1.53e-04 1.55e-04 7.5e-02 2.0e+00 5.1e-02 > 1.84e-01 > 5 24 -3.245e+03 2.69e-04 3.13e-04 1.2e-01 2.0e+00 1.0e-01 > 2.31e+01 > 6 26 -3.246e+03 9.61e-05 1.57e-04 4.6e-02 1.5e+00 4.5e-02 > 7.85e-04 > 7 27 -3.246e+03 3.77e-05 7.31e-05 4.2e-02 1.1e+00 4.5e-02 > 1.39e-04 > 8 28 -3.246e+03 6.77e-05 3.45e-05 6.1e-03 0.0e+00 7.4e-03 > 3.45e-05 > 9 30 -3.248e+03 6.91e-04 3.75e-04 6.4e-02 0.0e+00 8.1e-02 > 3.75e-04 > 10 32 -3.249e+03 2.17e-04 2.28e-04 2.4e-02 1.8e+00 3.3e-02 > 2.46e-03 > 11 34 -3.250e+03 3.51e-04 3.66e-04 4.5e-02 5.4e-01 6.5e-02 > 1.39e-03 > 12 36 -3.252e+03 7.61e-04 5.08e-04 8.1e-02 3.4e-01 1.3e-01 > 1.53e-03 > 13 44 -3.253e+03 4.73e-05 9.51e-05 1.1e-06 6.7e+00 1.9e-06 > 2.37e-01 > 14 45 -3.253e+03 4.08e-07 5.59e-07 1.1e-06 2.0e+00 1.9e-06 > 2.79e-01 > 15 46 -3.253e+03 1.69e-08 2.74e-08 1.1e-06 2.0e+00 1.9e-06 > 2.82e-01 > 16 55 -3.258e+03 1.73e-03 8.48e-04 3.5e-02 2.0e+00 6.3e-02 > 2.81e-01 > 17 57 -3.261e+03 7.56e-04 6.61e-04 6.8e-03 2.0e+00 1.3e-02 > 4.25e+01 > 18 59 -3.268e+03 2.22e-03 1.74e-03 1.3e-02 2.0e+00 2.5e-02 > 8.22e+03 > 19 61 -3.270e+03 5.11e-04 5.21e-04 2.6e-03 2.0e+00 5.1e-03 > 1.78e+06 > 20 67 -3.270e+03 9.28e-06 1.72e-05 9.4e-08 2.7e+01 1.8e-07 > 9.25e+02 > 21 68 -3.270e+03 5.41e-08 7.21e-08 9.3e-08 2.0e+00 1.8e-07 > 1.51e+03 > 22 77 -3.272e+03 5.88e-04 1.12e-03 6.1e-03 2.0e+00 1.2e-02 > 1.51e+03 > 23 79 -3.276e+03 1.41e-03 1.47e-03 4.9e-03 1.7e+00 1.2e-02 > 4.05e-02 > 24 86 -3.276e+03 9.34e-06 9.36e-06 6.1e-09 2.9e+01 1.2e-08 > 1.11e-01 > 25 88 -3.276e+03 1.83e-06 1.82e-06 1.2e-09 1.3e+02 2.4e-09 > 1.51e-01 > 26 90 -3.276e+03 3.61e-06 3.61e-06 2.4e-09 1.7e+01 4.8e-09 > 1.50e-01 > 27 92 -3.276e+03 7.14e-07 7.14e-07 4.8e-10 3.1e+02 9.5e-10 > 1.49e-01 > 28 94 -3.276e+03 1.43e-07 1.43e-07 9.7e-11 1.5e+03 1.9e-10 > 1.49e-01 > 29 96 -3.276e+03 2.85e-07 2.85e-07 1.9e-10 1.9e+02 3.8e-10 > 1.48e-01 > 30 99 -3.276e+03 5.69e-09 5.69e-09 3.9e-12 3.8e+04 7.6e-12 > 1.48e-01 > 31 101 -3.276e+03 1.14e-08 1.14e-08 7.7e-12 4.7e+03 1.5e-11 > 1.48e-01 > 32 103 -3.276e+03 2.28e-08 2.28e-08 1.5e-11 2.4e+03 3.0e-11 > 1.48e-01 > 33 107 -3.276e+03 4.55e-11 4.55e-11 3.1e-14 6.5e-01 6.1e-14 > -1.08e-01 > 34 109 -3.276e+03 9.11e-12 9.10e-12 6.2e-15 6.5e-01 1.2e-14 > -1.08e-01 > 35 111 -3.276e+03 1.82e-11 1.82e-11 1.2e-14 6.5e-01 2.4e-14 > -1.08e-01 > 36 113 -3.276e+03 -3.05e+06 3.64e-12 2.5e-15 6.5e-01 4.9e-15 > -1.08e-01 > > ***** FALSE CONVERGENCE ***** > > FUNCTION -3.276262e+03 RELDX 2.479e-15 > FUNC. EVALS 113 GRAD. EVALS 36 > PRELDF 3.642e-12 NPRELDF -1.078e-01 > > I FINAL X(I) D(I) G(I) > > 1 2.607871e-15 1.000e+00 2.453e+06 > 2 2.088683e-02 1.000e+00 2.110e+03 > 3 9.812705e-01 1.000e+00 1.556e+03 > > Warning message: > In sqrt(pred$e) : NaNs produced > > > Could anyone explain me what is the problem here and why the estimation > cannot be finished in this case? 'False convergence'....but I don't really > understand what is behind this message. > > > If anyone knows, please help R-help ;) > Thank you in advance > Greetings > Marcin > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.