Skip to content
Prev 206605 / 398503 Next

Confusion in 'quantile' and getting rolling estimation of sample quantiles

Gabor, 
about problem 1. , now I understand.
But in problem 2. , I do as your recommandation. and it still doesn't work.
I wonder is there any detail introduction about the form of the 'FUN' in the
'rollapply'?
Can you help me again?

Thank you very much!

Best regard
Saji


There is no quantile method defined for zoo objects so it falls
through to the default method but that method does not work for zoo
objects.  Try this:

set.seed(123)
rn <- rnorm(500)
quantile(rn, 0.8)
quantile(coredata(zoo(rn)), 0.8)

In the second question the error message tells you what the problem
is.  FUN is supposed to be a function but a vector of numbers has been
supplied rather than a function.  Try:

uprange=rollapply(x,width=10,FUN=function(x)quantile(x,0.8),align='right')



-----
------------------------------------------------------------------
Saji Ren
from Shanghai China
GoldenHeart Investment Group
------------------------------------------------------------------