[R] slope estimations of teeth like data
Petr Pikal
petr.pikal at precheza.cz
Tue Jun 15 13:11:45 CEST 2004
Dear all
Suppose I have teeth like data similar like
x <- 1:200
y <- 0.03*x[1:100]+rnorm(100, mean=.001, sd=.03)
z <- 3-rep(seq(1,100,10),each=10)*.03+rnorm(100,mean=.001, sd=.03)
plot(x,c(y,z))
and I want to have a gradient estimations for some values from increasing part of
data
like
y.agg <- aggregate(diff(c(y,z)), list(rep(seq(1,200,10),each=10)[1:199]), mean)
y.agg[1:10,] ##is OK, I want that
y.agg[11:20,] ##is not OK, I do not want that
actual data are similar but more irregular and have subsequent gradual increases
and decreases, more like
set.seed(1)
yy<-NULL
for( i in 1:10) yy <- c(yy,c(y,z)[1:floor(runif(1)*200)])
length(yy)
[1] 1098
plot(1:1098,yy)
Is there anybody who has some experience with such data, mainly how to extract
only increasing portions or to filter values of "yy" such as only aggregated slopes
from increasing parts are computed and other parts are set to NA. Sometimes
actual data have so long parts of steady or even slightly increasing values at
decreasing part that aggregated values are slightly positive although they are
actually from decreasing portion of data.
Thank you
Petr Pikal
petr.pikal at precheza.cz
More information about the R-help
mailing list