Skip to content
Prev 17444 / 398513 Next

covariance of equal date values

Hello Lukas,

I hope this short example will help


d1 <- data.frame(time=c(1,4,8,11,12,18),data=runif(6)) #some random data
d2 <- data.frame(time=c(1,4,9,10,12,17),data=runif(6)) #some random data
d <- data.frame(time=sort(unique(c(d1$time,d2$time))),data1=NA,data2=NA)
#combine the time
d[match(d1$time,d$time),'data1'] <-  d1$data #add the data
d[match(d2$time,d$time),'data2'] <-  d2$data #add the data
cov(d$data1,d$data2,use='complete')

gruess

joerg
Lukas Kubin wrote: