Displaying 1 result from an estimated 1 matches for "climateaudit".
2008 Apr 30
1
apply and monthly time series (PR#11352)
...231.2.44)
When I use the apply function to calculate a trend for a matrix of monthly time
series, it yields a different answer than when the trend is calculated one at a
time (by a factor of 12) rather than the identical answer as it should. Here's
an example:
download.file("http://www.climateaudit.org/data/models/monthly.tab","temp.dat",mode="wb")
load("temp.dat")
trend= function(x) lm(x~c(time(x)))$coef[2]
b= apply(monthly,2,trend)
a= c(trend(monthly[,1]),trend(monthly[,2]),trend(monthly[,3]))
a/b #12 12 12