[Highfrequency-commits] r109 - pkg/highfrequency/man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Sep 11 21:35:36 CEST 2014


Author: kboudt
Date: 2014-09-11 21:35:36 +0200 (Thu, 11 Sep 2014)
New Revision: 109

Modified:
   pkg/highfrequency/man/spotvol.Rd
Log:


Modified: pkg/highfrequency/man/spotvol.Rd
===================================================================
--- pkg/highfrequency/man/spotvol.Rd	2014-09-11 09:46:57 UTC (rev 108)
+++ pkg/highfrequency/man/spotvol.Rd	2014-09-11 19:35:36 UTC (rev 109)
@@ -294,15 +294,18 @@
 \code{ugarchfit} object used by the \code{rugarch} package.
 }
 \examples{
+# Load sample data
+
 data(sample_real5minprices)
+data(sample_returns_5min)
 
-# default method, deterministic periodicity
+# Default method, deterministic periodicity
+\dontshow{par.def <- par(no.readonly = TRUE)}
 vol1 <- spotvol(sample_real5minprices)
-par.def <- par(no.readonly = TRUE)
 plot(vol1)
-par(par.def)
-
-# compare to stochastic periodicity
+\dontshow{par(par.def)}
+# Compare to stochastic periodicity
+\donttest{
 init = list(sigma = 0.03, sigma_mu = 0.005, sigma_h = 0.007,
             sigma_k = 0.06, phi = 0.194, rho = 0.986, mu = c(1.87,-0.42),
             delta_c = c(0.25, -0.05, -0.2, 0.13, 0.02), delta_s = c(-1.2,
@@ -311,11 +314,10 @@
 vol2 <- spotvol(sample_real5minprices, method = "stochper", init = init)
 plot(as.numeric(vol1$spot[1:780]), type="l")
 lines(as.numeric(vol2$spot[1:780]), col="red")
-legend("topright", c("detper", "stochper"), col = c("black", "red"), lty=1)
+legend("topright", c("detper", "stochper"), col = c("black", "red"), lty=1)}
 
-data(sample_returns_5min)
+# Various kernel estimates
 
-# various kernel estimates
 h1 = bw.nrd0((1:nrow(sample_returns_5min))*(5*60))
 vol3 <- spotvol(sample_returns_5min, method = "kernel", h = h1)
 vol4 <- spotvol(sample_returns_5min, method = "kernel", est = "quarticity")
@@ -325,22 +327,23 @@
 lines(as.numeric(t(vol5$spot))[1:2880], col="blue")
 legend("topright", c("h = simple estimate", "h = quarticity corrected",
        "h = crossvalidated"), col = c("black", "red", "blue"), lty=1)
-par(par.def)
-
-# piecewise constant volatility, using an example from Fried (2012)
+\dontshow{par(par.def)}
+# Piecewise constant volatility, using an example from Fried (2012)
+\donttest{
 simdata <- matrix(sqrt(5/3)*rt(3000, df = 5), ncol = 500, byrow = TRUE)
 simdata <- c(1, 1, 1.5, 1.5, 2, 1)*simdata
 # the volatility of the simulated now changes at 1000, 2000 and 2500
 vol6 <- spotvol(simdata, method = "piecewise", m = 200, n  = 100,
                 online = FALSE)
-plot(vol6)
+plot(vol6)}
 
-# compare regular GARCH(1,1) model to eGARCH, both with external regressors
+# Compare regular GARCH(1,1) model to eGARCH, both with external regressors
+\donttest{
 vol7 <- spotvol(sample_returns_5min, method = "garch", model = "sGARCH")
 vol8 <- spotvol(sample_returns_5min, method = "garch", model = "eGARCH")
 plot(as.numeric(t(vol7$spot)), type = "l")
 lines(as.numeric(t(vol8$spot)), col = "red")
-legend("topleft", c("GARCH", "eGARCH"), col = c("black", "red"), lty=1)
+legend("topleft", c("GARCH", "eGARCH"), col = c("black", "red"), lty=1)}
 }
 \references{
 Andersen, T. G. and T. Bollerslev (1997). Intraday periodicity and volatility



More information about the Highfrequency-commits mailing list