### Name: kernel ### Title: Smoothing Kernel Objects ### Aliases: kernel bandwidth.kernel df.kernel is.tskernel plot.tskernel ### Keywords: ts ### ** Examples require(graphics) ## Demonstrate a simple trading strategy for the ## financial time series German stock index DAX. x <- EuStockMarkets[,1] k1 <- kernel("daniell", 50) # a long moving average k2 <- kernel("daniell", 10) # and a short one plot(k1) plot(k2) x1 <- kernapply(x, k1) x2 <- kernapply(x, k2) plot(x) lines(x1, col = "red") # go long if the short crosses the long upwards lines(x2, col = "green") # and go short otherwise ## More interesting kernels kd <- kernel("daniell", c(3,3)) kd # note the unusual indexing kd[-2:2] plot(kernel("fejer", 100, r=6)) plot(kernel("modified.daniell", c(7,5,3))) # Reproduce example 10.4.3 from Brockwell and Davis (1991) spectrum(sunspot.year, kernel=kernel("daniell", c(11,7,3)), log="no")