Observation
NegativeBinomialObservation
NegativeBinomialObservation(
name: str, concentration_rv: RandomVariable, eps: float = 1e-10
)
Bases: RandomVariable
Negative Binomial observation
Default constructor
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
Name for the numpyro variable. |
required |
concentration_rv
|
RandomVariable
|
Random variable from which to sample the positive concentration parameter of the negative binomial. This parameter is sometimes called k, phi, or the "dispersion" or "overdispersion" parameter, despite the fact that larger values imply that the distribution becomes more Poissonian, while smaller ones imply a greater degree of dispersion. |
required |
eps
|
float
|
Small value to add to the predicted mean to prevent numerical instability. Defaults to 1e-10. |
1e-10
|
Returns:
Type | Description |
---|---|
None
|
|
Source code in pyrenew/observation/negativebinomial.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
|
sample
Sample from the negative binomial distribution
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mu
|
ArrayLike
|
Mean parameter of the negative binomial distribution. |
required |
obs
|
ArrayLike | None
|
Observed data, by default None. |
None
|
**kwargs
|
Additional keyword arguments passed through to internal sample calls, should there be any. |
{}
|
Returns:
Type | Description |
---|---|
ArrayLike
|
|
Source code in pyrenew/observation/negativebinomial.py
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
|
validate
staticmethod
validate(concentration_rv: RandomVariable) -> None
Check that the concentration_rv is actually a RandomVariable
Parameters:
Name | Type | Description | Default |
---|---|---|---|
concentration_rv
|
RandomVariable
|
RandomVariable from which to sample the positive concentration parameter of the negative binomial. |
required |
Returns:
Type | Description |
---|---|
None
|
|
Source code in pyrenew/observation/negativebinomial.py
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
|
PoissonObservation
Bases: RandomVariable
Poisson observation process
Default Constructor
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
Passed to |
required |
eps
|
float
|
Small value added to the rate parameter to avoid zero values. Defaults to 1e-8. |
1e-08
|
Returns:
Type | Description |
---|---|
None
|
|
Source code in pyrenew/observation/poisson.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
|
sample
Sample from the Poisson process
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mu
|
ArrayLike
|
Rate parameter of the Poisson distribution. |
required |
obs
|
ArrayLike | None
|
Observed data. Defaults to None. |
None
|
**kwargs
|
Additional keyword arguments passed through to internal sample calls, should there be any. |
{}
|
Returns:
Type | Description |
---|---|
ArrayLike
|
|
Source code in pyrenew/observation/poisson.py
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
|