Poisson

vecxt_re.Poisson
See thePoisson companion class
object Poisson

Attributes

Companion
class
Graph
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Poisson.type

Members list

Type members

Inherited and Abstract types

type MirroredElemLabels <: Tuple

The names of the product elements.

The names of the product elements.

Attributes

Inherited from:
Mirror
type MirroredLabel <: String

The name of the type.

The name of the type.

Attributes

Inherited from:
Mirror

Value members

Concrete methods

inline def fromMean(mu: Double): Poisson

Create a Poisson distribution from the mean.

Create a Poisson distribution from the mean.

Value parameters

mu

the mean (rate) parameter

Attributes

Returns

a Poisson distribution with the given mean

def goodnessOfFit(observations: Array[Int], lambda: Option[Double] = ..., minExpected: Double = ...): (statistic: Double, degreesOfFreedom: Int, pValue: Double)

Perform a chi-squared goodness-of-fit test to assess whether the observed data follows a Poisson distribution.

Perform a chi-squared goodness-of-fit test to assess whether the observed data follows a Poisson distribution.

Groups observations into bins and computes the chi-squared statistic comparing observed to expected frequencies.

Value parameters

lambda

the Poisson rate parameter (if None, uses MLE from data)

minExpected

minimum expected frequency per bin (bins are combined to meet this threshold; a short upper tail is merged into the last full bin)

observations

array of non-negative integer observations

Attributes

Returns

Named tuple with statistic: the chi-squared test statistic, degreesOfFreedom: the degrees of freedom, and pValue: the p-value of the test. Degrees of freedom are cells − 1, less one more when lambda is estimated from the data.

def mle(observations: Array[Int]): (dist: Poisson, converged: Boolean)

Maximum likelihood estimation for Poisson parameter.

Maximum likelihood estimation for Poisson parameter.

For Poisson, the MLE of λ is simply the sample mean. This is exact and always converges in one step.

Value parameters

observations

array of non-negative integer observations

Attributes

Returns

Named tuple with dist: the fitted Poisson distribution, and converged: always true for Poisson MLE

inline def mleVolumeWeighted(observations: Array[Int], volumes: Array[Double]): (dist: Poisson, converged: Boolean)
def volweightedMle(observations: Array[Int], volumes: Array[Double]): (dist: Poisson, converged: Boolean)

Maximum likelihood estimation for volume-adjusted Poisson.

Maximum likelihood estimation for volume-adjusted Poisson.

For observations $n_j$ with corresponding volumes $v_j$, the Poisson model assumes $n_j \sim \text{Poisson}(\lambda v_j)$.

The MLE for $\lambda$ is: $$ \hat{\lambda} = \frac{\sum_j n_j}{\sum_j v_j} $$

Value parameters

observations

non-negative counts $n_j$

volumes

positive volume ratios $v_j$ (same units as modeled period)

Attributes

Returns

tuple of fitted Poisson(lambda) and a convergence flag (always true for Poisson)

Givens

Givens

given poissonDecoder: Decoder[Poisson]
given poissonEncoder: Encoder[Poisson]

JSON codec. Only lambda is written; derived state (sampler, RNG) is rebuilt on decode. Constructor validation failures surface as a io.circe.DecodingFailure.

JSON codec. Only lambda is written; derived state (sampler, RNG) is rebuilt on decode. Constructor validation failures surface as a io.circe.DecodingFailure.

Attributes