# NOT RUN {
## Generate some fake data
set.seed(1)
n <- 100 # number of data points
t <- seq(0,4*pi,,100)
a <- 3
b <- 2
c.unif <- runif(n)
amp <- 4
# generate data and calculate "y"
set.seed(1)
y1 <- a*sin(b*t)+c.unif*amp # add uniform error
# SEA applied to fake dendrochronological data in CE
plot(rev(seq(1901,2000,1)), y1, t="l", ylim=range(y1)*c(1.2))
y=c(1923,1948,1972,1995)
points(y,rep(0,length(y)))
x=data.frame(rev(seq(1901,2000,1)),value=y1)
lag=10
#Perform SEA
res=SEA(x, y, lag, b = NULL, conf = c(0.05, 0.95), nboot = 1000, age="CE")
plot(res,xlim=c(-10,10),xlab="lag",ylab="Composite mean")
# SEA applied to fake paleoecological data in BP
plot(seq(-50,49,1), y1, t="l", ylim=range(y1)*c(1.2),xlim=c(50,-50))
y=1950-c(1923,1948,1972,1995)
points(y,rep(0,length(y)))
x=data.frame(seq(-50,49,1),value=y1)
# Perform SEA
res=SEA(x, y, lag, b = NULL, conf = c(0.05, 0.95), nboot = 1000, age="BP")
plot(res,xlim=c(-10,10),xlab="lag",ylab="Composite mean")
# }
Run the code above in your browser using DataLab