|
Essential Wavelets for Statistical Applications and Data Analysis R.T. Ogden, University of South Carolina 0-8176-3864-4 * 1996 * $40.00 * Hardcover * 285 pages * 40 Illustrations |
Fig9.11n <- function()
{
# postscript(file="Fig9.11.ps",height=3.9,width=6.5,horiz=F)
par(mar = c(1.5, 1.5, 1.5, 0.5), mgp = c(5, 0.4, 0))
rs <- c(57, 14, 55, 51, 30, 0, 53, 44, 34, 53, 49, 2)
.Random.seed <- rs
x <- (1:128)/128
y <- 2 * c(rep(1, 64), rep(-1, 64)) + rnorm(128)
plot(x, y, type = "l")
yest <- spincyclen(y, filter.number = 1)
lines(x, yest)
# graphics.off()
NULL
}
shift <- function(x,h)
{
n <- length(x)
if(h == 0 || h == n)
ans <- x
else ans <- c(x[(1 + h):n], x[1:h])
return(ans)
}
spincyclen <- function(y, filter.number = 5, type = "hard",
levels = 0:(log(length(y), 2) - 1))
{
# This version uses Nason's software
n <- length(y)
est <- rep(0, n)
for(i in 0:(n - 1))
est <- est + shift(wr(threshold(wd(shift(y, i), filter.number
= filter.number), type = type, levels = levels)), n - i)
return(est/n)
}