Displaying 1 result from an estimated 1 matches for "1981,24".
Did you mean:
1681,24
2005 Jan 12
4
Finding seasonal peaks in a time series....
...54
foo <- sin((2 * pi * 1/24) * 1:nPts)
foo <- foo + rnorm(nPts, 0, 0.05)
bar <- ts(foo, start = c(1980,3), frequency = 24)
plot(bar)
start(bar)
end(bar)
# I want to find the peak value from each year, and then get the mean
of the values on either side.
# So, if the peak value in the year 1981 is
max.in.1981 <- max(window(bar, start = c(1981,1), end = c(1981,24)))
# e.g, cycle 7 or 8
window(bar, start = c(1981,1), end = c(1981,24)) == max.in.1981
# E.g. if the highest value in 1981 is in cycle 8 I want
mean.in.1981 <- mean(window(bar, start = c(1981,5), end = c(1981,11)))
plot(bar)...