Running examples in ‘AER-Ex.R’ failed
The error most likely occurred in:

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: MSCISwitzerland
> ### Title: MSCI Switzerland Index
> ### Aliases: MSCISwitzerland
> ### Keywords: datasets
> 
> ### ** Examples
> 
> data("MSCISwitzerland", package = "AER")
> 
> ## p.190, Fig. 7.6
> dlmsci <- 100 * diff(log(MSCISwitzerland))
> plot(dlmsci)
> 
> dlmsci9501 <- window(dlmsci, end = as.Date("2001-12-31"))
> 
> ## Figure 7.7
> plot(acf(dlmsci9501^2, lag.max = 200, na.action = na.exclude),
+   ylim = c(-0.1, 0.3), type = "l")
> 
> 
> ## GARCH(1,1) model, p.190, eq. (7.60)
> 
> ## standard errors using first derivatives (as apparently used by Franses et al.)
> library("tseries")
> msci9501_g11 <- garch(zooreg(dlmsci9501), trace = FALSE)
> summary(msci9501_g11)

Call:
garch(x = zooreg(dlmsci9501), trace = FALSE)

Model:
GARCH(1,1)

Residuals:
     Min       1Q   Median       3Q      Max 
-5.30570 -0.50860  0.05433  0.68275  5.71286 

Coefficient(s):
    Estimate  Std. Error  t value Pr(>|t|)    
a0  0.039017    0.007657    5.096 3.48e-07 ***
a1  0.115525    0.011968    9.653  < 2e-16 ***
b1  0.853031    0.016621   51.323  < 2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Diagnostic Tests:
	Jarque Bera Test

data:  Residuals
X-squared = 322.29, df = 2, p-value < 2.2e-16


	Box-Ljung test

data:  Squared.Residuals
X-squared = 0.74665, df = 1, p-value = 0.3875

> 
> ## standard errors using second derivatives
> library("fGarch")
Loading required package: timeDate
Loading required package: timeSeries

Attaching package: ‘timeSeries’

The following object is masked from ‘package:zoo’:

    time<-

Loading required package: fBasics

Attaching package: ‘fBasics’

The following object is masked from ‘package:car’:

    densityPlot

> msci9501_g11a <- garchFit( ~ garch(1,1), include.mean = FALSE,
+   data = dlmsci9501, trace = FALSE)
> summary(msci9501_g11a)

Title:
 GARCH Modelling 

Call:
 garchFit(formula = ~garch(1, 1), data = dlmsci9501, include.mean = FALSE, 
    trace = FALSE) 

Mean and Variance Equation:
 data ~ garch(1, 1)
<environment: 0x55e5a3b51de8>
 [data = dlmsci9501]

Conditional Distribution:
 norm 

Coefficient(s):
   omega    alpha1     beta1  
0.039178  0.115480  0.852834  

Std. Errors:
 based on Hessian 

Error Analysis:
        Estimate  Std. Error  t value Pr(>|t|)    
omega   0.039178    0.009849    3.978 6.96e-05 ***
alpha1  0.115480    0.016283    7.092 1.32e-12 ***
beta1   0.852834    0.020529   41.543  < 2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Log Likelihood:
 -2566.521    normalized:  -1.405543 

Description:
 Wed Feb 28 15:49:25 2018 by user:  


Standardised Residuals Tests:
                                Statistic p-Value     
 Jarque-Bera Test   R    Chi^2  322.9214  0           
 Shapiro-Wilk Test  R    W      0.9811351 8.649613e-15
 Ljung-Box Test     R    Q(10)  18.75341  0.04350883  
 Ljung-Box Test     R    Q(15)  20.53832  0.1522397   
 Ljung-Box Test     R    Q(20)  24.34765  0.2275358   
 Ljung-Box Test     R^2  Q(10)  3.462443  0.9683582   
 Ljung-Box Test     R^2  Q(15)  5.965694  0.9803183   
 Ljung-Box Test     R^2  Q(20)  9.606936  0.9747523   
 LM Arch Test       R    TR^2   5.307112  0.9469268   

Information Criterion Statistics:
     AIC      BIC      SIC     HQIC 
2.814372 2.823424 2.814366 2.817711 

> 
> round(msci9501_g11a@fit$coef, 3)
 omega alpha1  beta1 
 0.039  0.115  0.853 
> round(msci9501_g11a@fit$se.coef, 3)
 omega alpha1  beta1 
 0.010  0.016  0.021 
> 
> ## Fig. 7.8, p.192
> plot(msci9501_g11a, which = 2)
> abline(h = sd(dlmsci9501))
> 
> 
> ## TGARCH model (also known as GJR-GARCH model), p. 191, eq. (7.61)
> msci9501_tg11 <- garchFit( ~ aparch(1,1), include.mean = FALSE,
+   include.delta = FALSE, delta = 2, data = dlmsci9501, trace = FALSE)
> summary(msci9501_tg11)

Title:
 GARCH Modelling 

Call:
 garchFit(formula = ~aparch(1, 1), data = dlmsci9501, delta = 2, 
    include.mean = FALSE, include.delta = FALSE, trace = FALSE) 

Mean and Variance Equation:
 data ~ aparch(1, 1)
<environment: 0x55e5a67251c0>
 [data = dlmsci9501]

Conditional Distribution:
 norm 

Coefficient(s):
   omega    alpha1    gamma1     beta1  
0.050659  0.085286  0.427898  0.856101  

Std. Errors:
 based on Hessian 

Error Analysis:
        Estimate  Std. Error  t value Pr(>|t|)    
omega    0.05066     0.01180    4.293 1.76e-05 ***
alpha1   0.08529     0.01767    4.825 1.40e-06 ***
gamma1   0.42790     0.09671    4.425 9.66e-06 ***
beta1    0.85610     0.02348   36.463  < 2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Log Likelihood:
 -2544.281    normalized:  -1.393363 

Description:
 Wed Feb 28 15:49:25 2018 by user:  


Standardised Residuals Tests:
                                Statistic p-Value     
 Jarque-Bera Test   R    Chi^2  301.5135  0           
 Shapiro-Wilk Test  R    W      0.9829266 6.022347e-14
 Ljung-Box Test     R    Q(10)  21.50685  0.01782377  
 Ljung-Box Test     R    Q(15)  23.62407  0.07175874  
 Ljung-Box Test     R    Q(20)  27.88416  0.1121699   
 Ljung-Box Test     R^2  Q(10)  3.943423  0.9498632   
 Ljung-Box Test     R^2  Q(15)  5.817795  0.9826484   
 Ljung-Box Test     R^2  Q(20)  8.491098  0.9880874   
 LM Arch Test       R    TR^2   5.445769  0.9414114   

Information Criterion Statistics:
     AIC      BIC      SIC     HQIC 
2.791107 2.803177 2.791098 2.795560 

> 
> ## GJR form using reparameterization as given by Ding et al. (1993, pp. 100-101)
> coef(msci9501_tg11)["alpha1"] * (1 - coef(msci9501_tg11)["gamma1"])^2  ## alpha*
    alpha1 
0.02791431 
> 4 * coef(msci9501_tg11)["alpha1"] * coef(msci9501_tg11)["gamma1"]      ## gamma*
   alpha1 
0.1459754 
> 
> ## GARCH and GJR-GARCH with rugarch
> library("rugarch")
Error in library("rugarch") : there is no package called ‘rugarch’
Execution halted