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

> ### 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
Warning: multiple methods tables found for ‘plot’

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

Warning: multiple methods tables found for ‘plot’
> msci9501_g11a <- garchFit( ~ garch(1,1), include.mean = FALSE,
+   data = dlmsci9501, trace = FALSE)
Warning: Using formula(x) is deprecated when x is a character vector of length > 1.
  Consider formula(paste(x, collapse = " ")) instead.
> 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: 0xfe02750>
 [data = dlmsci9501]

Conditional Distribution:
 norm 

Coefficient(s):
   omega    alpha1     beta1  
0.039179  0.115480  0.852833  

Std. Errors:
 based on Hessian 

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

Log Likelihood:
 -2566.521    normalized:  -1.405543 

Description:
 Sat Mar  7 07:20:37 2020 by user:  


Standardised Residuals Tests:
                                Statistic p-Value     
 Jarque-Bera Test   R    Chi^2  322.9197  0           
 Shapiro-Wilk Test  R    W      0.9811352 8.650003e-15
 Ljung-Box Test     R    Q(10)  18.75346  0.04350821  
 Ljung-Box Test     R    Q(15)  20.53837  0.1522383   
 Ljung-Box Test     R    Q(20)  24.34772  0.2275329   
 Ljung-Box Test     R^2  Q(10)  3.462481  0.968357    
 Ljung-Box Test     R^2  Q(15)  5.965708  0.980318    
 Ljung-Box Test     R^2  Q(20)  9.606899  0.9747529   
 LM Arch Test       R    TR^2   5.307122  0.9469264   

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)
Error in as.double(y) : 
  cannot coerce type 'S4' to vector of type 'double'
Calls: plot -> plot -> plot.default -> xy.coords
Execution halted