Errors in running code in vignettes:
when running code in 'Anx12.Rnw'

> owidth <- getOption("width")

> options(width = 60, continue = "+ ", warn = -1)

> .PngNo <- 0

> nom.fich = "anx12-bitmap-"

> require(caschrono)
Loading required package: caschrono
Loading required package: zoo

Attaching package: 'zoo'

The following objects are masked from 'package:base':

    as.Date, as.Date.numeric


> set.seed(1618)

> nobs = 300

> zt = rnorm(nobs + 10)

> sig2 = rep(0, nobs + 10)

> epsil = sig2

> y = sig2

> for (i in 2:(nobs + 10)) {
+     sig2[i] <- 0.1 + 0.9 * epsil[i - 1]^2
+     epsil[i] <- sig2[i]^0.5 * zt[i]
+     y[i] <- 5 + epsil[i]
+ }

> y <- y[-(1:10)]

> require(fGarch)
Loading required package: 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

> spec.1 <- garchSpec(model = list(mu = 5, omega = 0.1, 
+     alpha = 0.9, beta = 0), rseed = 397)

> archsim.1 <- garchSim(extended = TRUE, spec.1, n = 300, 
+     n.start = 10)

> head(archsim.1, 2)
GMT
              garch     sigma        eps
2021-04-09 5.172777 0.3175684  0.5440636
2021-04-10 4.668813 0.3561837 -0.9298203

> moyenne <- mean(archsim.1[, 1])

> ret <- c(6, 12, 18)

> a1 <- Box.test.2(archsim.1[, 1], ret, type = "Box-Pierce", 
+     decim = 8)

> a2 <- Box.test.2((archsim.1[, 1] - moyenne)^2, ret, 
+     type = "Box-Pierce", decim = 8)

> a3 <- Box.test.2(archsim.1[, 3]^2, ret, type = "Box-Pierce", 
+     decim = 8)

> a123 <- cbind(a1, a2[, 2], a3[, 2])

> colnames(a123) <- c("Retard", "p.val y1", "p.val y1 centre carre", 
+     "p.val z_t")

> require(xtable)
Loading required package: xtable

Attaching package: 'xtable'

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

    align

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

    align


> xtable(a123, caption = "Test de blancheur, p-values", 
+     label = "blanc.y", digits = 4)
% latex table generated in R 4.2.0 by xtable 1.8-4 package
% Thu Feb  3 03:29:58 2022
\begin{table}[ht]
\centering
\begin{tabular}{rrrrr}
  \hline
 & Retard & p.val y1 & p.val y1 centre carre & p.val z\_t \\ 
  \hline
1 & 6.0000 & 0.0987 & 0.0000 & 0.5416 \\ 
  2 & 12.0000 & 0.0724 & 0.0000 & 0.8543 \\ 
  3 & 18.0000 & 0.0656 & 0.0000 & 0.8044 \\ 
   \hline
\end{tabular}
\caption{Test de blancheur, p-values} 
\label{blanc.y}
\end{table}

> spec <- garchSpec(model = list(mu = 2, omega = 0.09, 
+     alpha = c(0.15, 0.3), beta = 0.4), rseed = 9647)

> var.margi = 0.09/(1 - 0.15 - 0.3 - 0.4)

> y = garchSim(spec, n = 420, extended = TRUE)

> y1 = y[21:420, 1]

> m1 = mean(y1)

> (q5 = quantile(abs(y1 - m1), probs = c(0.975, 0.98, 
+     0.985, 0.99, 0.995)))
   97.5%      98%    98.5%      99%    99.5% 
2.965956 3.095066 3.696268 5.500659 6.443857 

> extrem985 = which(abs(y1 - m1) > q5[3])

> cat("nombre de points : ", length(extrem985), "\n")
nombre de points :  6 

> y1b = y1

> y1b[extrem985] <- q5[3] * sign(y1[extrem985] - m1)

> mod1 <- garchFit(~garch(2, 1), data = y1b, trace = FALSE, 
+     include.mean = TRUE)

> param = c("alpha2", "beta1")

> estim = as.matrix(coef(mod1)[param])

> vcov.par = mod1@fit$cvar[param, param]

> t.alpha = (coef(mod1)["alpha2"] - 0.3)/mod1@fit$se.coef["alpha2"]

> p.val = 2 * pnorm(-abs(t.alpha))

> cat("p-value : ", p.val, "\n")
p-value :  0.5430931 

> theo = as.matrix(c(0.3, 0.4))

> differ = estim - theo

> khi = t(differ) %*% solve(vcov.par) %*% differ

> cat("stat de test et p-value : ", c(khi, 1 - pchisq(khi, 
+     df = 2)), "\n")
stat de test et p-value :  0.942412 0.624249 

> data(csdl)

> aa = returns(csdl, percentage = TRUE)

> aab = aa[complete.cases(aa) == TRUE, ]

> r.csdl = zoo(aab, as.POSIXct(row.names(aab)))

> r.lor <- window(r.csdl[, "L_Oreal"], start = "2007-12-28")

> r.lor.0 = r.lor[1:(length(r.lor) - 51)]

> r.lor.1 = r.lor[(length(r.lor) - 50):length(r.lor)]

> require("forecast")
Loading required package: forecast

> mod.r.lor = Arima(as.numeric(r.lor.0), order = c(0, 
+     0, 4), include.mean = FALSE, fixed = c(NA, NA, 0, NA))

> var.marg.est <- function(mod) {
+     param.estim <- mod@fit$par
+     std.estim <- mod@fit$se.coef
+     k <- which(names(param.estim) == "omega")
 .... [TRUNCATED] 

> mod.garch.lor <- garchFit(~garch(1, 1), data = as.numeric(r.lor.0), 
+     trace = FALSE, include.mean = TRUE, na.action = na.pass)

> summary(mod.garch.lor)

Title:
 GARCH Modelling 

Call:
 garchFit(formula = ~garch(1, 1), data = as.numeric(r.lor.0), 
    include.mean = TRUE, trace = FALSE, na.action = na.pass) 

Mean and Variance Equation:
 data ~ garch(1, 1)
<environment: 0x000001cf0bcd0e70>
 [data = as.numeric(r.lor.0)]

Conditional Distribution:
 norm 

Coefficient(s):
      mu     omega    alpha1     beta1  
-0.11752   0.41167   0.16990   0.77714  

Std. Errors:
 based on Hessian 

Error Analysis:
        Estimate  Std. Error  t value Pr(>|t|)    
mu      -0.11752     0.11406   -1.030  0.30285    
omega    0.41167     0.21080    1.953  0.05084 .  
alpha1   0.16990     0.06137    2.768  0.00564 ** 
beta1    0.77714     0.06733   11.542  < 2e-16 ***
---
Signif. codes:  
0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Log Likelihood:
 -740.5119    normalized:  -2.271509 

Description:
 Thu Feb  3 03:29:59 2022 by user: ContainerUser 


Standardised Residuals Tests:
                                Statistic p-Value     
 Jarque-Bera Test   R    Chi^2  36.86351  9.889845e-09
 Shapiro-Wilk Test  R    W      0.9821095 0.0004385604
 Ljung-Box Test     R    Q(10)  25.53336  0.004421175 
 Ljung-Box Test     R    Q(15)  33.02164  0.004661624 
 Ljung-Box Test     R    Q(20)  38.65471  0.007358024 
 Ljung-Box Test     R^2  Q(10)  6.494036  0.7721907   
 Ljung-Box Test     R^2  Q(15)  8.542488  0.9002      
 Ljung-Box Test     R^2  Q(20)  10.21509  0.9641019   
 LM Arch Test       R    TR^2   6.25739   0.902555    

Information Criterion Statistics:
     AIC      BIC      SIC     HQIC 
4.567558 4.614023 4.567261 4.586100 


> var.marg.est(mod.garch.lor)
variance marginale :  7.772921 

> npred = 50

> pred.arima.lor = predict(mod.r.lor, n.ahead = npred)

> pred.garch.lor = predict(mod.garch.lor, n.ahead = npred)

> str(pred.arima.lor)
List of 2
 $ pred: Time-Series [1:50] from 327 to 376: 0.32 0.779 0.62 -1.004 0 ...
 $ se  : Time-Series [1:50] from 327 to 376: 2.36 2.41 2.44 2.44 2.52 ...

> demi = qnorm(0.95) * pred.arima.lor$se

> binf.arima.lor = pred.arima.lor$pred - demi

> bsup.arima.lor = pred.arima.lor$pred + demi

> demi = qnorm(0.95) * pred.garch.lor$standardDeviation

> binf.garch.lor = pred.garch.lor$meanForecast - demi

> bsup.garch.lor = pred.garch.lor$meanForecast + demi

> .PngNo <- .PngNo + 1

> file = paste(nom.fich, .PngNo, sep = "")

> pdf(file = paste(file, ".pdf", sep = ""), width = 7, 
+     height = 4, pointsize = 10, bg = "white")

> par(oma = rep(0.5, 4))

> mat.lor = cbind(binf.arima.lor, bsup.arima.lor, binf.garch.lor, 
+     bsup.garch.lor, r.lor.1[1:npred])

  When sourcing 'Anx12.R':
Error: non-time series not of the correct length
Execution halted

  'Anx1.Rnw' using 'latin1'... OK
  'Anx10.Rnw' using 'latin1'... OK
  'Anx12.Rnw' using 'latin1'... failed
  'Anx2.Rnw' using 'latin1'... OK
  'Anx3.Rnw' using 'latin1'... OK
  'Anx4.Rnw' using 'latin1'... OK
  'Anx5.Rnw' using 'latin1'... OK
  'Anx6.Rnw' using 'latin1'... OK
  'Anx7.Rnw' using 'latin1'... OK
  'Anx9.Rnw' using 'latin1'... OK