epinowcast
Loading...
Searching...
No Matches
obs_lpmf.stan File Reference

Go to the source code of this file.

Functions

real obs_lpmf (array[] int obs, vector log_exp_obs, array[] real phi, int model_obs)
 
real obs_lpmf (int obs, real log_exp_obs, array[] real phi, int model_obs)
 

Function Documentation

◆ obs_lpmf() [1/2]

real obs_lpmf ( array[]int obs,
vector log_exp_obs,
array[]real phi,
int model_obs )

Observation likelihood

Computes the log probability mass function (LPMF) for observations. This function is overloaded to handle both vectorized and non-vectorized inputs.

Parameters
obsObservations, can be a single integer (non-vectorized) or an array of integers (vectorized).
log_exp_obsLogarithm of expected observations, can be a single real (non-vectorized) or a vector (vectorized).
phiDispersion parameter for the negative binomial model, ignored for the Poisson model. Should be an array with the first element used.
model_obsIndicator of the model used (0 for Poisson, 1 for negative binomial with a quadratic mean-variance relationship, 2 for negative binomial with a linear mean-variance relationship).
Returns
The log probability mass of the observations under the specified model.
Note
The function selects between the negative binomial model and the Poisson model based on the model_obs flag. It uses neg_binomial_2_log_lpmf for the negative binomial model and poisson_log_lpmf for the Poisson model.

Definition at line 28 of file obs_lpmf.stan.

◆ obs_lpmf() [2/2]

real obs_lpmf ( int obs,
real log_exp_obs,
array[]real phi,
int model_obs )

Definition at line 43 of file obs_lpmf.stan.