Displaying 4 results from an estimated 4 matches for "rollfun".
2005 Apr 02
1
Survey of "moving window" statistical functions - still looking f or fast mad function
...ckage)
3. kernapply(x, kernel("daniell", m), circular=T)
4. apply(embed(x,k), 1, mean)
5. mywinfun <- function(x, k, FUN=mean, ...) { # suggested in news
group n <- length(x) A <- rep(x, length=k*(n+1)) dim(A) <- c(n+1, k)
sapply(split(A, row(A)), FUN, ...)[1:(n-k+1)] }
6. rollFun(x, k, FUN=mean) - (fSeries package)
7. rollMean(x, k) - (fSeries package)
8. SimpleMeanLoop = function(x, k) { n = length(x) # simple-minded
loop used as a baseline y = rep(0, n) k = k%/%2; for (i in (1+k):(n-k))
y[i] = mean(x[(i-k):(i+k)]) }
9. running(x, fun=mean, width=k) - (gtools package)...
2004 Oct 08
1
Survey of "moving window" statistical functions - still looking f or fast mad function
...ot;daniell", m), circular=T)
4. apply(embed(x,k), 1, mean)
5. mywinfun <- function(x, k, FUN=mean, ...)
{ # suggested in news group
n <- length(x)
A <- rep(x, length=k*(n+1))
dim(A) <- c(n+1, k)
sapply(split(A, row(A)), FUN, ...)[1:(n-k+1)]
}
6. rollFun(x, k, FUN=mean) - (fSeries package)
7. rollMean(x, k) - (fSeries package)
8. SimpleMeanLoop = function(x, k) {
n = length(x) # simple-minded loop used as a
baseline
y = rep(0, n)
k = k%/%2;
for (i in (1+k):(n-k)) y[i] = mean(x[(i-k):(i+k)])
}
9. running(x, fun=...
2005 Mar 02
2
apply a function to a rolling subset of a vector
Try this:
> ?convolve
> x<-rnorm(1000)
> y<-rep(1,20)
> z<-convolve(x,y,type="filter")
> plot(x,type="l")
> str(z)
num [1:981] 6.31 7.28 8.16 7.39 4.65 ...
> lines(c(rep(0,10),z,rep(0,10)),col="yellow",lwd=3)
> lines(c(rep(0,10),z,rep(0,10))/length(y),col="red",lwd=3) #running mean
You wrote:
Does anyone know an easy way
2009 Nov 27
2
How to compute Rolling analysis of Standard Deviation using ZOO package?
..."c", and i want get a period of 10 days,
so i write the command below:
roll.sd = rollapply( c, 10, sd, na.pad = TRUE, align = 'right' )
but there is an error in it ,and the computing cannot be performed.
Can anyone help?
PLUS: I also found that there is a function called "rollFun" in package
'fSeries', but there isn't anymore.
[[alternative HTML version deleted]]