d <- cbind(rollapply(x, FUN="max", width=96), rollapply(x, FUN="min", width=96)) if you have fifteen minute interval data 1day is equal to 96 time steps.
the brute force method would be cbind((x[,1]*x[,2]), (x[,2]*x[,3])) this should work On Fri, Jul 25, 2008 at 1:10 PM, rcoder <[EMAIL PROTECTED]> wrote: > > You mean embedding something like a range() function in a rollapply > function? > I'm just not sure how it will handle outputting max and min values in > sequence and in the correct columns. > > On a parallel topic, I would like to find some way of generating a matrix > containing rows that are the product of sequential rows in a preceeding > matrix: i.e. rows 1*2 -> row 1 in o/p matrix; rows2*3-> row 2; rows > 4*5->row3 etc. > > Thanks, > > rcoder > > > > stephen sefick wrote: > > > > how about rollapply in the zoo package? > > > > On Fri, Jul 25, 2008 at 8:37 AM, rcoder <[EMAIL PROTECTED]> wrote: > > > >> > >> Hi Achim, > >> > >> Thanks for your reply. rollmean and rollmax functions exist, but is > there > >> anything for returning the minima on a rolling basis? I know there is no > >> rollmin in the zoo library. > >> > >> Thanks, > >> > >> rcoder > >> > >> > >> > >> Achim Zeileis wrote: > >> > > >> > On Thu, 24 Jul 2008, rcoder wrote: > >> > > >> >> Hi everyone, > >> >> > >> >> I want to calculate a min and max (i.e. range) on a rolling time > frame > >> of > >> >> 50 > >> >> periods for a matrix with the number of periods extending along the > >> row > >> >> direction. So for 300 periods, there will be 6 time frame windows per > >> >> column, and 6 min max pairs. I then want to o/p these pairs to a > >> separate > >> >> matrix. > >> >> > >> >> On a separate matter, I have a matrix containing data on which > perform > >> a > >> >> regresssion over a rolling time period. Is there a convenient way I > >> can > >> >> do > >> >> this for each column, and then save the gradient to an o/p matrix? > >> > > >> > Look at the package "zoo", specifically the examples on the manual > >> pages > >> > of ?rollapply and ?aggregate.zoo. These should be helpful in doing > what > >> > you want. The package vignettes have further worked examples. > >> > > >> > hth, > >> > Z > >> > > >> >> Thanks, > >> >> > >> >> rcoder > >> >> -- > >> >> View this message in context: > >> >> > >> > http://www.nabble.com/Rolling-range-and-regression-calculations-tp18643465p18643465.html > >> >> Sent from the R help mailing list archive at Nabble.com. > >> >> > >> >> ______________________________________________ > >> >> R-help@r-project.org mailing list > >> >> https://stat.ethz.ch/mailman/listinfo/r-help > >> >> PLEASE do read the posting guide > >> >> http://www.R-project.org/posting-guide.html > >> >> and provide commented, minimal, self-contained, reproducible code. > >> >> > >> >> > >> > > >> > ______________________________________________ > >> > R-help@r-project.org mailing list > >> > https://stat.ethz.ch/mailman/listinfo/r-help > >> > PLEASE do read the posting guide > >> > http://www.R-project.org/posting-guide.html > >> > and provide commented, minimal, self-contained, reproducible code. > >> > > >> > > >> > >> -- > >> View this message in context: > >> > http://www.nabble.com/Rolling-range-and-regression-calculations-tp18643465p18650915.html > >> Sent from the R help mailing list archive at Nabble.com. > >> > >> ______________________________________________ > >> R-help@r-project.org mailing list > >> https://stat.ethz.ch/mailman/listinfo/r-help > >> PLEASE do read the posting guide > >> http://www.R-project.org/posting-guide.html > >> and provide commented, minimal, self-contained, reproducible code. > >> > > > > > > > > -- > > Let's not spend our time and resources thinking about things that are so > > little or so large that all they really do for us is puff us up and make > > us > > feel like gods. We are mammals, and have not exhausted the annoying > little > > problems of being mammals. > > > > -K. Mullis > > > > [[alternative HTML version deleted]] > > > > ______________________________________________ > > R-help@r-project.org mailing list > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide > > http://www.R-project.org/posting-guide.html > > and provide commented, minimal, self-contained, reproducible code. > > > > > > -- > View this message in context: > http://www.nabble.com/Rolling-range-and-regression-calculations-tp18643465p18655895.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > -- Let's not spend our time and resources thinking about things that are so little or so large that all they really do for us is puff us up and make us feel like gods. We are mammals, and have not exhausted the annoying little problems of being mammals. -K. Mullis [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.