[Rd] apply and monthly time series (PR#11352)

From: <stephen.mcintyre_at_utoronto.ca>
Date: Wed, 30 Apr 2008 15:00:04 +0200 (CEST)


Full_Name: Stephen McIntyre
Version: 2.7
OS: Windows XP
Submission from: (NULL) (99.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



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Wed 30 Apr 2008 - 17:10:23 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 30 Apr 2008 - 17:31:24 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive