haskell / haskell/statistics

Enumerating discrete distributions

Abierto
#89 2 comentarios 0 reacciones 0 asignados Ver en GitHub
help needed
Lenguaje dominante
Haskell
Estrellas
309
Forks
76
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

I have quite a few applications where I need to compute the pdf (or cdf) of a discrete distribution over the whole range [n, n+1, ..., n+N]. At the moment, that requires calling the pdf (or cdf) function for each value in the range. However, for many distributions it's much quicker to calculate the first case and then use your knowledge of the distribution to calculate the values for [n+1, ..., n+N]. You then end up with an unfolding operation:

``` haskell
pdfFromTo :: (DiscreteDistribution d, Vector v Double) => d -> Int -> Int -> v Double
```

which for the binomial distribution would look like

``` haskell
-- assume 0 <= n0 <= n1 <= n for simplicity
pdfFromTo binDist n0 n1 = iterateN (n1 - n0) (\x -> x * (n-k) * p / (k+1) / (1-p)) (probability binDist n0)
```

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.