Distributions
CensoredNormal
CensoredNormal(
loc: ArrayLike = 0,
scale: ArrayLike = 1,
lower_limit: float = -inf,
upper_limit: float = inf,
validate_args: bool | None = None,
)
Bases: Distribution
Censored normal distribution under which samples are truncated to lie within a specified interval. This implementation is adapted from https://github.com/dylanhmorris/host-viral-determinants/blob/main/src/distributions.py
Default constructor
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
loc
|
ArrayLike
|
The mean of the normal distribution. Defaults to 0. |
0
|
scale
|
ArrayLike
|
The standard deviation of the normal distribution. Must be positive. Defaults to 1. |
1
|
lower_limit
|
float
|
The lower bound of the interval for censoring. Defaults to -inf (no lower bound). |
-inf
|
upper_limit
|
float
|
The upper bound of the interval for censoring. Defaults to inf (no upper bound). |
inf
|
validate_args
|
bool | None
|
If True, checks if parameters are valid. Defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
None
|
|
Source code in pyrenew/distributions/censorednormal.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | |
log_prob
Computes the log probability density of a given value(s) under the censored normal distribution.
Returns:
| Type | Description |
|---|---|
Array
|
Containing log probability of the given value(s) under the censored normal distribution |
Source code in pyrenew/distributions/censorednormal.py
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | |
sample
Generates samples from the censored normal distribution.
Returns:
| Type | Description |
|---|---|
Array
|
Containing samples from the censored normal distribution. |
Source code in pyrenew/distributions/censorednormal.py
76 77 78 79 80 81 82 83 84 85 86 87 88 89 | |