weighting: Weighting functions

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Set of functions to compute spatial weights between probes.

Usage

1
2
3
4
triangWeight(distance, win)
rectangWeight(distance, win)
gaussWeight(distance, win)
epWeight(distance, win)

Arguments

distance

Numeric vector specifying the distance of probes from the central probe. Negative values refer to probes upstream, positive values to probes downstream.

win

Integer specifying maximum size of window.

Details

The functions 'triangWeight', 'rectangWeight', 'epWeight' and 'gaussWeight' provide a triangular, rectangular, Epanechnikov and Gaussian weighting window, respectively. The weighting function can be specified by the 'weightingFunction' argument in the 'estimate' method.

This way it is also possible to use custom weighting functions. In general they have to be called the same way as the functions mentioned before and have to return a vector of weights of the same length as the argument 'distance'. For more details on how to use own weighting functions please refer to the vignette of this package.

Please note that the returned weights do not have to be normalized since this is done at the computation of the weighted cumulative density.

Value

A numeric vector with weights for each probe in the window.

Author(s)

Julian Gehring

Maintainer: Julian Gehring <julian.gehring@fdm.uni-freiburg.de>

See Also

Package: les-package

Class: Les

Methods and functions: Les estimate threshold regions ci chi2 export plot

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
distance <- seq(-50, 50)
win <- 50

weight <- triangWeight(distance, win)
plot(distance, weight, type="l", main="triangWeight")

weight <- rectangWeight(distance, win)
plot(distance, weight, type="l", main="rectangWeight")

weight <- gaussWeight(distance, win)
plot(distance, weight, type="l", main="gaussWeight")

weight <- epWeight(distance, win)
plot(distance, weight, type="l", main="epWeight")

## simple example for a custom weighting function
ownWeighting <- function(distance, win)  {
    weight <- as.integer(abs(distance) < win)
    return(weight)
}

Example output

Loading required package: fdrtool

les documentation built on Nov. 8, 2020, 5:17 p.m.