tmp <- ts.intersect(as.ts(return), lag(marketcap, -1)) tmp[,1]*tmp[,2]
is a lot more intuitive, easier to generalize and keeps the timebase information around.
On Wed, 1 Dec 2004 [EMAIL PROTECTED] wrote:
On 01-Dec-04 Uwe Ligges wrote:(Ted Harding) wrote:[...] Let
N<-length(return) new.var <- return[2:N]*marketcap[1:(N-1)]
Ted, I aggree to all of your points, but we can simplify by negative indices (and hence circumvent your note 1): return[-1] * marketcap[-N]
Uwe Ligges
Neat footwork, Uwe! (Why didn;t I think of that? No, don't answer ... ) Ted.
-------------------------------------------------------------------- E-Mail: (Ted Harding) <[EMAIL PROTECTED]> Fax-to-email: +44 (0)870 094 0861 [NB: New number!] Date: 01-Dec-04 Time: 08:00:22 ------------------------------ XFMail ------------------------------
______________________________________________ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
-- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
______________________________________________ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html