Skip to content

Cumulant function is not numerically stable #899

Open
@mattcbro

Description

@mattcbro

The recursion used for calculating cumulants from a sequence of data is not numerically stable. Apparently this is known in the literature and is discussed in this paper:
https://www-2.rotman.utoronto.ca/~kan/papers/ncq.pdf

I offer a simple test showing that the cumulants of a gaussian vector, which should all be zero after the second one, diverge.

using StatsBase
using Plots

# create a long sampled vector from a normal distribution
N = 10000
v = randn(N)


# compute and plot the cumulants.  Only the second
# one should be nonzero
kix = 1:15
rkstats = cumulant(v, kix)
plot(kix, rkstats)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions