JuliaStats / Distributions.jl

A Julia package for probability distributions and associated functions.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Characteristic function for Univariate Mixtures

tlamadon opened this issue · comments

I would like to suggest adding this method to compute the characteristic function of Univariate Mixtures:

function cf(d::UnivariateMixture,t)
    p = probs(d)
    m = sum(pi * cf(component(d, i),t) for (i, pi) in enumerate(p) if !iszero(pi))
    return m
end

This is a simple copy of the mean function but applied to the characteristic function. So I think it could be added next to it:

function mean(d::UnivariateMixture)

It matches the general cf signature as seen here:

"""
cf(d::UnivariateDistribution, t)
Evaluate the characteristic function of distribution `d`.
"""