Displaying 2 results from an estimated 2 matches for "cummean".
Did you mean:
comman
2007 Mar 12
1
How to avoid a for-loop?
...the extrema of the cumulated sum of a detrended time
series. The following code is currently used, please have a look at the
comments for my questions and remarks:
system.time({
X <- rnorm(10000)
X.length <- length(X)
X.cum.sum <- cumsum(X)
X.cum.mean <- cummean(X)
# initializing the "output" vectors
X.min.detrended <- rep(NA,X.length)
X.max.detrended <- rep(NA,X.length)
for (i in 1:X.length) {
# Detrending of the time series from index 1 to i
# I think that's the time consuming part, are there any
# suggestions how to do this...
2009 Sep 22
3
Function similar to cumsum/cumprod
Hello, everyone
I wonder if there is in R somewhere a function similar to cumsum().
The function calculates a statistic (say mean or standard deviation)
buy adding consequtively one more data point.
So, say I have a timeseries of 100 observations.
I start by calculating mean of first 30 observations
Then I add one observation and calculate mean of 31 observations
Then I add one more observation