Displaying 2 results from an estimated 2 matches for "testzoo".
Did you mean:
testfoo
2010 Dec 21
1
lm() on a matrix of zoo series
I have a matrix of zoo series. each series is in a column.
x <- as.yearmon(2000 + seq(0, 23)/12)
# 24 months of data, lets make 20 sets of random data
testData <- matrix(rnorm(480),ncol=20)
# make a zoo object and columns will hold the 20 series
TestZoo <- zoo(testData,order.by=x)
# now run lm for just one series.
m <- lm(TestZoo[,1]~time(TestZoo))$coeff[2]
m
time(TestZoo)
0.3443124
m2 <- lm(TestZoo[,2]~time(TestZoo))$coeff[2]
m2
time(TestZoo)
-0.1192866
I've been struggling trying to use apply ( or something equally suit...
2010 Aug 20
1
differecing a zoo series
...t;Dec 2000" "Jan 2001"
[14] "Feb 2001" "Mar 2001" "Apr 2001" "May 2001" "Jun 2001" "Jul 2001" "Aug
2001" "Sep 2001" "Oct 2001" "Nov 2001" "Dec 2001"
data<-seq(1,24,by=1)
testzoo<-zoo(data,order.by=x)
The operation I ant to perform on the zoo series is this. I will illustrate
with a small example and formula:
the coredata of the zoo series is 1,2,3,4,5,6,7,8 )
I want to calculate Result<- zoo[x]-zoo[x-1] (NA,1,1,1,1,1...NA)
The first element of course is undefi...