Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 205466

An error when fitting a GJH GARCH model in R

$
0
0

Recently, I intend to forecast the conditional variance of daily stock returns through a GRJ GARCH model. However, I face an unexpected error as:

Error in xts(object@fit$fitted.values, D) : 
  'order.by' cannot contain 'NA', 'NaN', or 'Inf'

My codes are:

spec.gjrGARCH =  ugarchspec(variance.model=list(model="gjrGARCH", garchOrder=c(1,1)),
                              distribution.model="std")
gjrGARCH <- ugarchfit(data=garch.sample, spec=spec.gjrGARCH)

I have checked that there are no "NA" or "Inf" in my data matrix. A summary of my data sample is shown as:

 head(garch.sample)
                      V1            V2
1966-02-01 -2.583820e-05 -7.877959e-05
1966-02-02 -1.556989e-02 -8.054168e-04
1966-02-03 -3.326661e-05 -5.629779e-05
1966-02-04 -4.517833e-05 -5.390856e-05
1966-02-07 -2.517368e-05 -7.760792e-05
1966-02-08 -5.919566e-05 -5.115820e-05

summary(garch.sample)
       V1                   V2            
 Min.   :-1.557e-02   Min.   :-9.898e-03  
 1st Qu.:-7.227e-05   1st Qu.:-6.774e-05  
 Median :-5.344e-05   Median :-5.810e-05  
 Mean   : 1.714e-04   Mean   : 7.513e-04  
 3rd Qu.:-3.266e-05   3rd Qu.:-4.436e-05  
 Max.   : 1.598e-02   Max.   : 1.635e-02 

I do appreciate if anyone could give any answers to solve this error.


Viewing all articles
Browse latest Browse all 205466

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>