Re: [R] Rolling range and regression calculations

2008-07-25 Thread Gabor Grothendieck
> library(zoo) > z <- zoo(101:110) > rollapply(z, 3, min) 2 3 4 5 6 7 8 9 101 102 103 104 105 106 107 108 > rollapply(z, 3, max) 2 3 4 5 6 7 8 9 103 104 105 106 107 108 109 110 > rollapply(z, 3, range) 2 101 103 3 102 104 4 103 105 5 104 106 6 105 107 7 106 108 8 10

Re: [R] Rolling range and regression calculations

2008-07-25 Thread stephen sefick
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 PROTECTE

Re: [R] Rolling range and regression calculations

2008-07-25 Thread rcoder
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 o

Re: [R] Rolling range and regression calculations

2008-07-25 Thread stephen sefick
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 li

Re: [R] Rolling range and regression calculations

2008-07-25 Thread rcoder
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

Re: [R] Rolling range and regression calculations

2008-07-25 Thread Achim Zeileis
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.

[R] Rolling range and regression calculations

2008-07-24 Thread rcoder
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