[R] covariance of equal date values
Joerg Maeder
maeder at atmos.umnw.ethz.ch
Tue Feb 26 13:28:30 CET 2002
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:
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> I need to count the covariance of two time series. Both of them contain
> the dates' vector and vector of values. But the dates are not the same. It
> means some dates of first ts are not in the second respectively. And I
> need the covariance of same dates, of course.
> Could anyone help me, please?
> Thank you.
>
> lukas
>
> - --
> Lukas Kubin
> lukas.kubin at permonik.com
> phone: 00420603836180
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.0.5 (GNU/Linux)
> Comment: For info see http://www.gnupg.org
>
> iD8DBQE8e2B14TIZ2lmUAtsRAi3AAJ0Sd7G8MkFMPmdmfhBxDFcHo4CjaQCgjcLZ
> bbVG0SM5cMYKk497WJzsAe8=
> =N1KE
> -----END PGP SIGNATURE-----
>
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
--
Joerg Maeder .:|:||:..:.||.:: maeder at atmos.umnw.ethz.ch
Tel: +41 1 633 36 25 .:|:||:..:.||.::
http://www.iac.ethz.ch/staff/maeder
PhD student at INSTITUTE FOR ATMOSPHERIC AND CLIMATE SCIENCE (IACETH)
ETH ZÜRICH Switzerland
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list