lecdf: Detrend data using local e.c.d.f.

lecdfR Documentation

Detrend data using local e.c.d.f.

Description

Transform data by removing the trend from them and convert them to local e.c.d.f. (empirical cumulative distribution function). Each element of y gets transformed into a number in the unit interval, values near 0 represent relatively low values of y (in the context of their neighbourhood), values near 1 represent relatively high values of y.

Usage

lecdf(x, y, bandwidth = 0.2)

Arguments

x

vector of x-coordinates

y

vector of y-coordinates

bandwidth

bandwidth defining the neighbourhood in which to evaluate the quantiles

Value

A vector of local quantiles.

Author(s)

Tomas Sieger

Examples

set.seed(1)
n<-100
x<-runif(n,0,10)
y<-sin(x)+runif(n)
layout(rbind(1,2))
# color points according to their vertical position
# considering their local neighbourhood
l<-lecdf(x,y,bandwidth=.1)
plot(x,y,pch=19,col=topo.colors(100)[rank(l)],main='bandwidth=.1')
# use larger bandwidth
l<-lecdf(x,y,bandwidth=.5)
plot(x,y,pch=19,col=topo.colors(100)[rank(l)],main='bandwidth=.5')
layout(1)

tsieger/tsiMisc documentation built on Oct. 10, 2023, 10:24 p.m.