Displaying 2 results from an estimated 2 matches for "my_series".
2007 Jan 18
4
How to optimize this loop ?
Dear R Users,
I request your help to optimize a loop.
Given a series of observations, I want to know how many consecutive past
observations are below the last one.
e.g :
my_series <- c(3, 4, 10,14,8,3,4,6,9)
As the last number (9) is higher than the four preceding numbers (6, 4, 3, 8),
this function should return 4.
my_series <- c(3, 4, 10,14,8,3,4,11,9)
Here, it should return 0, as 9 is immediately preceeded by a higher number.
So far, I do this awful loop :
resu...
2010 Apr 13
0
ccf problem (cross-correlation)
Hi all,
I have a problem concerning my understanding of the cross-correlation (ccf)
function in R.
assume a time serie as:
> t<-seq(0,6.28,by=0.01);
> my_serie<-ts(sin(t),start=0,end=6.28,deltat=0.01)
then I generate an other one shifted by 12 time points:
> my_shifted_serie<-ts(sin(t),start=0+0.12,end=6.28+0.12,deltat=0.01)
if I do the cross-correlation I get that the two