binomLikelihoodSmooth: Calculates local likelihood estimations for binomial random...

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

Description

For a given set of binomial random variables with 1-dimensional coordinates, this function calculates the local likelihood estimation of the success probability p at a given point. For this purpose, a weighted likelihood estimation with weights obtained by a triangular kernel with given bandwidth is used. This can be used to predict values at points where no variable has been observed and/or to smooth observations using neighboured observations.

Usage

1
binomLikelihoodSmooth(pred.pos, pos, m, n, h)

Arguments

pred.pos

A vector of positions where p should be estimated.

pos

A vector of positions where binomial variables have been observed.

m

A vector of length pos with the number of successfull experiments.

n

A vector of length pos with the number of experiments.

h

The bandwidth of the kernel.

Details

For a given position x, the weighted likelihood for parameter p

L(p; m, n, w) = ∏_{i=1}^k B(m_i|n_i,p)^{w_i}

is maximized. B denotes the binomial probability function. The weights w_i are calculated using a triangular kernel with bandwidth h:

w_i = K(x_i) = (1 - (|x - x_i|)/h) \mathbf{1}_{((|x - x_i|)/h) ≤ 1}

Value

A vector of length pred.pos giving the local likelihood estimation of the success probability p at the given positions.

Author(s)

Hans-Ulrich Klein

See Also

predictMeth

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
n = rpois(100, lambda=10)
E = c(rep(0.4, 30), rep(0.8, 40), rep(0.1, 30))
m = rbinom(100, n, E)
pos = 1:100
p_10 = binomLikelihoodSmooth(pos, pos, m, n, h=10)
p_20 = binomLikelihoodSmooth(pos, pos, m, n, h=20)

## Not run: plot(x=pos, y=m/n)
points(x=pos, y=p_10, col="green")
lines(x=pos, y=p_10, col="green")
points(x=pos, y=p_20, col="red")
lines(x=pos, y=p_20, col="red")
## End(Not run)

BiSeq documentation built on Nov. 8, 2020, 8:05 p.m.