I can't explain the results you're getting, but I think what you're looking
for is:
zl <- rollapply(z, 5, align='left',min)

On 8/22/07, Voss, Kent <VOSSK@kochind.com> wrote:
>
> I am getting some unexpected results using rollapply and the cummin
> function that I am hoping someone can help me understand.  I'm just trying
> to get a rolling cumulative minimum of a time series.  Think of it as the
> maximum loss over a rolling window.
>
> Here's an example
> # Create a dummy sequence to use with a set of dates used to create a zoo
> object
> x <- c(0,rep(c(seq(1,5,by=1),seq(-1,-3, by=-1)),2))
> DateList <- as.Date(seq(ISOdate(1990,1,1), length.out=length(x), by="1
> day"), '%Y-%m-%d')
>
> z <- zoo(x,DateList)
>
> # Doing the following gets expected results, a rolling 5 day sum.  So far
> so good
> zl <- rollapply(z, 5, align='left',sum)
>
> # The following however creates an n x n matrix where n = the length of z,
> that I can't quite figure out
> zl <- rollapply(z, 5, align='left',cummin)
>
>
> Now I'm pretty new at this stuff, so I'm sure there's something I'm
> missing, but I can't make heads or tails around the results of the
> cummin.  Any help would be greatly appreciated.  Thanks in advance.
>
> Kent
>
>
>
>
>
> "EMF <kochind.com>" made the following annotations.
>
> ------------------------------------------------------------------------------
> The information in this e-mail and any attachments is confidential and
> intended solely for the attention and use of the named addressee(s). It must
> not be disclosed to any person without proper authority. If you are not the
> intended recipient, or a person responsible for delivering it to the
> intended recipient, you are not authorized to and must not disclose, copy,
> distribute, or retain this message or any part of it.
>
>
> ==============================================================================
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-SIG-Finance@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only.
> -- If you want to post, subscribe first.
>

	[[alternative HTML version deleted]]

