ugarchfit-methods: function: Univariate GARCH Fitting

Description Usage Arguments Details Value Note Author(s) See Also Examples

Description

Method for fitting a variety of univariate GARCH models.

Usage

1
2
ugarchfit(spec, data, out.sample = 0, solver = "solnp", solver.control = list(), 
fit.control = list(stationarity = 1, fixed.se = 0, scale = 0, rec.init = 'all'), ...)

Arguments

data

A univariate data object. Can be a numeric vector, matrix, data.frame, zoo, xts, timeSeries, ts or irts object.

spec

A univariate GARCH spec object of class uGARCHspec.

out.sample

A positive integer indicating the number of periods before the last to keep for out of sample forecasting (see details).

solver

One of either “nlminb”, “solnp”, “lbfgs”, “gosolnp”, “nloptr” or “hybrid” (see notes).

solver.control

Control arguments list passed to optimizer.

fit.control

Control arguments passed to the fitting routine. Stationarity explicitly imposes the variance stationarity constraint during optimization. The fixed.se argument controls whether standard errors should be calculated for those parameters which were fixed (through the fixed.pars argument of the ugarchspec function). The scale parameter controls whether the data should be scaled before being submitted to the optimizer. The rec.init option determines the type of initialization for the variance recursion. Valid options are ‘all’ which uses all the values for the unconditional variance calculation, an integer greater than or equal to 1 denoting the number of data points to use for the calculation, or a positive numeric value less than one which determines the weighting for use in an exponential smoothing backcast.

...

For the multiplicative component sGARCH model (mcsGARCH), the additional argument ‘DailyVar’ is required and should be an xts object of the daily forecasted variance to use with the intraday data.

Details

The GARCH optimization routine first calculates a set of feasible starting points which are used to initiate the GARCH recursion. The main part of the likelihood calculation is performed in C-code for speed.
The out.sample option is provided in order to carry out forecast performance testing against actual data. A minimum of 5 data points are required for these tests. If the out.sample option is positive, then the routine will fit only N - out.sample (where N is the total data length) data points, leaving out.sample points for forecasting and testing using the forecast performance measures. In the ugarchforecast routine the n.ahead may also be greater than the out.sample number resulting in a combination of out of sample data points matched against actual data and some without, which the forecast performance tests will ignore.
The “gosolnp” solver allows for the initialization of multiple restarts of the solnp solver with randomly generated parameters (see documentation in the Rsolnp-package for details of the strategy used). The solver.control list then accepts the following additional (to the solnp) arguments: “n.restarts” is the number of solver restarts required (defaults to 1), “parallel” (logical), “pkg” (either snowfall or multicore) and “cores” (the number of cores or workers to use) for use of parallel functionality, “rseed” is the seed to initialize the random number generator, and “n.sim” is the number of simulated parameter vectors to generate per n.restarts.
The “hybrid” strategy solver first tries the “solnp” solver, in failing to converge then tries then “nlminb”, the “gosolnp” and finally the “nloptr” solvers. Solver control parameters can be passed for all the solvers in the solver.control list as one long list which will be filtered for each solver's specific options as and when that solver is called during the hybrid strategy optimization. It is still possible that the Hessian at the optimal found cannot be inverted, in which case a warning is printed and there will not be any standard errors. In this case it is suggested that the problem is re-run with different solver parameters. It is also possible that the solution, while still ‘almost’ optimal may be at a saddle-point very near the global optimum in which case the Hessian may still be invertible but one eigenvalue is negative. The uGARCHfit object has a value in the fit slot called condH (object@fit$condH) which indicates the approximate number of decimal places lost to roundoff/numerical estimation error. When this is NaN, this indicates the case just described of one negative eigenvalue/saddlepoint (this previously flagged a warning but is now silenced and it is upto to the user to decide whether it is worth investigating further).

Value

A uGARCHfit object containing details of the GARCH fit.

Note

The nloptr solver takes the following options in the solver.control list:

ftol_rel function value relative tolerance default: 1e-8
xtol_rel parameter value relative tolerance default: 1e-6
maxeval maximum function evaluations default: 25000
print_level trace level default: 1
solver the nloptr solver to use default: 1 (‘SBPLX’).

The solver option for nloptr has 10 different choices (1:10), which are 1:‘COBYLA’, 2:‘BOBYQA’, 3:‘PRAXIS’, 4:‘NELDERMEAD’, 5:‘SBPLX’, 6:‘AUGLAG’+‘COBYLA’, 7:‘AUGLAG’+‘BOBYQA’, 8:‘AUGLAG’+‘PRAXIS’, 9:‘AUGLAG’+‘NELDERMEAD’ and 10:‘AUGLAG’+‘SBPLX’. As always, your mileage will vary and care should be taken on the choice of solver, tuning parameters etc. If you do use this solver try 9 or 10 first.

Author(s)

Alexios Ghalanos

See Also

For specification ugarchspec,filtering ugarchfilter, forecasting ugarchforecast, simulation ugarchsim, rolling forecast and estimation ugarchroll, parameter distribution and uncertainty ugarchdistribution, bootstrap forecast ugarchboot.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# Basic GARCH(1,1) Spec
data(dmbp)
spec = ugarchspec()
fit = ugarchfit(data = dmbp[,1], spec = spec)
fit
coef(fit)
head(sigma(fit))
#plot(fit,which="all")
# in order to use fpm (forecast performance measure function)
# you need to select a subsample of the data:
spec = ugarchspec()
fit = ugarchfit(data = dmbp[,1], spec = spec, out.sample=100)
forc = ugarchforecast(fit, n.ahead=100)
# this means that 100 data points are left from the end with which to
# make inference on the forecasts
fpm(forc)

Example output

Loading required package: parallel

Attaching package: 'rugarch'

The following object is masked from 'package:stats':

    sigma

Warning messages:
1: In rgl.init(initValue, onlyNULL) : RGL: unable to open X11 display
2: 'rgl_init' failed, running with rgl.useNULL = TRUE 
3: .onUnload failed in unloadNamespace() for 'rgl', details:
  call: fun(...)
  error: object 'rgl_quit' not found 

*---------------------------------*
*          GARCH Model Fit        *
*---------------------------------*

Conditional Variance Dynamics 	
-----------------------------------
GARCH Model	: sGARCH(1,1)
Mean Model	: ARFIMA(1,0,1)
Distribution	: norm 

Optimal Parameters
------------------------------------
        Estimate  Std. Error  t value Pr(>|t|)
mu     -0.006096    0.008739 -0.69759 0.485435
ar1    -0.409923    0.302412 -1.35551 0.175255
ma1     0.464582    0.293542  1.58268 0.113496
omega   0.011529    0.002916  3.95300 0.000077
alpha1  0.160496    0.026845  5.97868 0.000000
beta1   0.795689    0.033737 23.58537 0.000000

Robust Standard Errors:
        Estimate  Std. Error  t value Pr(>|t|)
mu     -0.006096    0.009072 -0.67196 0.501609
ar1    -0.409923    0.300554 -1.36389 0.172603
ma1     0.464582    0.292450  1.58858 0.112154
omega   0.011529    0.006431  1.79261 0.073036
alpha1  0.160496    0.048002  3.34353 0.000827
beta1   0.795689    0.066573 11.95222 0.000000

LogLikelihood : -1103.89 

Information Criteria
------------------------------------
                   
Akaike       1.1245
Bayes        1.1415
Shibata      1.1245
Hannan-Quinn 1.1307

Weighted Ljung-Box Test on Standardized Residuals
------------------------------------
                        statistic p-value
Lag[1]                     0.1174  0.7319
Lag[2*(p+q)+(p+q)-1][5]    1.2282  0.9998
Lag[4*(p+q)+(p+q)-1][9]    2.2781  0.9694
d.o.f=2
H0 : No serial correlation

Weighted Ljung-Box Test on Standardized Squared Residuals
------------------------------------
                        statistic p-value
Lag[1]                      2.169  0.1408
Lag[2*(p+q)+(p+q)-1][5]     3.163  0.3781
Lag[4*(p+q)+(p+q)-1][9]     4.920  0.4413
d.o.f=2

Weighted ARCH LM Tests
------------------------------------
            Statistic Shape Scale P-Value
ARCH Lag[3]     1.469 0.500 2.000  0.2255
ARCH Lag[5]     1.471 1.440 1.667  0.6000
ARCH Lag[7]     3.274 2.315 1.543  0.4634

Nyblom stability test
------------------------------------
Joint Statistic:  1.2113
Individual Statistics:             
mu     0.1599
ar1    0.1810
ma1    0.1858
omega  0.3695
alpha1 0.2737
beta1  0.3562

Asymptotic Critical Values (10% 5% 1%)
Joint Statistic:     	 1.49 1.68 2.12
Individual Statistic:	 0.35 0.47 0.75

Sign Bias Test
------------------------------------
                   t-value   prob sig
Sign Bias          1.52220 0.1281    
Negative Sign Bias 0.01559 0.9876    
Positive Sign Bias 0.79683 0.4256    
Joint Effect       3.14035 0.3705    


Adjusted Pearson Goodness-of-Fit Test:
------------------------------------
  group statistic p-value(g-1)
1    20     117.3    3.498e-16
2    30     133.6    2.272e-15
3    40     146.4    2.454e-14
4    50     153.3    1.127e-12


Elapsed time : 1.361422 

          mu          ar1          ma1        omega       alpha1        beta1 
-0.006096116 -0.409922515  0.464581809  0.011528557  0.160495951  0.795689235 
                [,1]
1970-01-02 0.4704051
1970-01-03 0.4363161
1970-01-04 0.4038926
1970-01-05 0.3770112
1970-01-06 0.3646844
1970-01-07 0.3536044
      1975-02-18
MSE   0.07082127
MAE   0.18761129
DAC   0.54000000
N   100.00000000

rugarch documentation built on May 2, 2019, 4:43 p.m.