Skip to content

Censored distributions #1833

Closed
Closed
@domenzain

Description

@domenzain

Is there a way to express left, right or interval censored distributions?

Here's a small example illustrating the differences with numpy:

#!/usr/bin/env python
import numpy as np
import matplotlib.pyplot as plt
np.random.seed(123)

# Create normally distributed samples.
size = 10000
sigma = 1.
mu = 1.
samples = np.random.normal(mu, sigma, size)

# Define bounds for the distribution
lower=0.
upper=1.

# Keep information about samples being outside of the range.
censored = samples.copy()
censored[censored > upper] = upper
censored[censored < lower] = lower

# Lose all information outside the range that can be sampled. 
truncated = samples[(samples >= lower) & (samples <= upper)]

plt.hist([samples, censored, truncated], bins=40)
plt.show()

Using Bound and Normal I can describe something like the truncated distribution.
But many processes behave like censored. How can the latter be expressed in PyMC3?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions