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

View source: R/binomLikelihoodSmooth.R

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.

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

`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 |

`n` |
A vector of length |

`h` |
The bandwidth of the kernel. |

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}*

A vector of length `pred.pos`

giving the local likelihood estimation of
the success probability p at the given positions.

Hans-Ulrich Klein

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. 1, 2018, 2:25 a.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.