![]() |
FIMS
v0.8.1
|
Implements the NormalLPDF distribution functor used by FIMS to evaluate observation-level and total log-likelihood contributions under a normal error model for data, priors, and random effects. More...
#include <normal_lpdf.hpp>
Public Member Functions | |
| NormalLPDF () | |
| Constructor. | |
| virtual | ~NormalLPDF () |
| Destructor. | |
| virtual const Type | evaluate () |
| Evaluates the normal log probability density function. | |
Public Member Functions inherited from fims_distributions::DensityComponentBase< Type > | |
| Type & | get_observed (size_t i) |
Retrieve one observed value based on input_type. | |
| Type & | get_observed (size_t i, size_t j) |
Retrieve one observed matrix-like value based on input_type. | |
| Type & | get_expected (size_t i) |
Retrieve one expected value based on input_type and use_mean. | |
| size_t | get_n_x () |
| Get length of the active observed input vector. | |
| size_t | get_n_expected () |
| Get length of the active expected input vector. | |
| DensityComponentBase () | |
| Constructor, which initializes default prior pointer state and ID. | |
Public Member Functions inherited from fims_model_object::FIMSObject< Type > | |
| uint32_t | GetId () const |
| Getter that returns the unique id for parameters in the model. | |
| bool | CheckDimensions (size_t actual, size_t expected) |
| Check the dimensions of an object. | |
Public Attributes | |
| fims::Vector< Type > | log_sd |
| The natural log of the standard deviation of the distribution. The argument can be a vector or scalar, where the latter is referenced for each instance through the use of get_force_scalar(). | |
Public Attributes inherited from fims_distributions::DensityComponentBase< Type > | |
| std::string | input_type |
| Classification of the input pathway for this distribution object. Options used by accessor methods are, "prior", "random_effects", and "data". | |
| std::shared_ptr< fims_data_object::DataObject< Type > > | data_observed_values |
| Observed data. | |
| fims::Vector< Type > | expected_values |
| Expected value vector for prior-based pathways. | |
| fims::Vector< Type > * | re = NULL |
| Pointer to random effects vector. | |
| fims::Vector< Type > * | re_expected_values = NULL |
| Expected value vector for random-effects pathways. | |
| fims::Vector< Type > * | data_expected_values = NULL |
| Expected value vector for data pathways. | |
| std::vector< fims::Vector< Type > * > | priors |
| Vector of pointers where each entry points to a prior parameter. | |
| fims::Vector< Type > | observed_values |
| Input value of distribution function for priors or random effects. | |
| fims::Vector< Type > | expected_mean |
| The expected mean of the distribution; overrides expected values. | |
| std::string | use_mean = fims::to_string("no") |
If "yes", expected_mean is used instead of expected_values. The default is "no" leading to the use of expected_values. | |
| Type | lpdf |
| Total log probability density contribution of the distribution. | |
| int | observed_data_id_m = -999 |
| ID of observed data component. | |
| fims::Vector< Type > | lpdf_vec |
| Vector storing observation-level log-likelihood contributions. | |
| bool | osa_flag = false |
| Boolean; if true, one-step-ahead (OSA) residuals are calculated. | |
| bool | simulate_flag = false |
| Boolean; if true, data are simulated from the distribution. | |
| std::vector< uint32_t > | key |
| Unique ID for variable map that points to a fims::Vector. | |
Public Attributes inherited from fims_model_object::FIMSObject< Type > | |
| uint32_t | id |
| std::vector< Type * > | parameters |
| std::vector< Type * > | random_effects_parameters |
| std::vector< Type * > | fixed_effects_parameters |
Additional Inherited Members | |
Static Public Attributes inherited from fims_distributions::DensityComponentBase< Type > | |
| static uint32_t | id_g = 0 |
| Global unique identifier for distribution modules. | |
Implements the NormalLPDF distribution functor used by FIMS to evaluate observation-level and total log-likelihood contributions under a normal error model for data, priors, and random effects.
This implementation relies on TMB's R-style dnorm() utility for normal log-density calculations. Specifically, when evaluating the normal likelihood, observations are passed to dnorm(..., give_log = true) to obtain log-density values.
For data input, values equal to na_value are skipped and contribute zero to the objective. Per-observation contributions are stored in lpdf_vec; the summed total is returned by evaluate() and stored in lpdf.
|
inlinevirtual |
Evaluates the normal log probability density function.
The following equation is normal probability density function, and thus, the log of it evaluated:
\[ f(x) = \frac{1}{\sigma\sqrt{2\pi}}\mathrm{exp}\Bigg(-\frac{(x-\mu)^2}{2\sigma^2} \Bigg), \]
where \(\mu\) is the mean of the distribution and \(\sigma^2\) is the variance.
Implements fims_distributions::DensityComponentBase< Type >.