12#ifndef DENSITY_COMPONENT_BASE_HPP
13#define DENSITY_COMPONENT_BASE_HPP
15#include "../../common/data_object.hpp"
16#include "../../common/model_object.hpp"
17#include "../../interface/interface.hpp"
18#include "../../common/fims_vector.hpp"
19#include "../../common/fims_math.hpp"
21namespace fims_distributions {
26template <
typename Type>
31 std::shared_ptr<fims_data_object::DataObject<Type>>
39 std::vector<fims::Vector<Type>*>
56 if (this->input_type ==
"data") {
59 if (this->input_type ==
"random_effects") {
62 if (this->input_type ==
"prior") {
64 throw std::runtime_error(
"No priors defined for this distribution.");
65 }
else if (
priors.size() == 1) {
67 }
else if (
priors.size() > 1) {
81 if (this->input_type ==
"data") {
84 if (this->input_type ==
"random_effects") {
87 if (this->input_type ==
"prior") {
88 return (*(
priors[i, j]))[0];
99 if (this->input_type ==
"data") {
101 }
else if (this->use_mean ==
"yes") {
103 }
else if (this->input_type ==
"random_effects") {
115 if (this->input_type ==
"data") {
118 if (this->input_type ==
"random_effects") {
121 if (this->input_type ==
"prior") {
132 if (this->input_type ==
"data") {
133 return (*data_expected_values).size();
135 if (this->input_type ==
"random_effects") {
136 return (*re_expected_values).size();
138 if (this->input_type ==
"prior") {
150template <
typename Type>
167 std::vector<uint32_t>
171 ::objective_function<Type>* of;
194template <
typename Type>
Definition fims_vector.hpp:27
Type & get_force_scalar(size_t pos)
If this vector is size 1 and pos is greater than zero, the first index is returned....
Definition fims_vector.hpp:182
size_type size() const
Returns the number of elements.
Definition fims_vector.hpp:273
Base class for all module_name functors.
Definition density_components_base.hpp:152
std::vector< uint32_t > key
Definition density_components_base.hpp:168
fims::Vector< Type > lpdf_vec
Definition density_components_base.hpp:160
bool simulate_flag
Definition density_components_base.hpp:165
bool osa_flag
Definition density_components_base.hpp:164
fims::Vector< Type > report_lpdf_vec
Definition density_components_base.hpp:162
DensityComponentBase()
Constructor.
Definition density_components_base.hpp:176
virtual const Type evaluate()=0
Generic probability density function. Calculates the pdf at the independent variable value.
static uint32_t id_g
Default id of the singleton distribution class.
Definition density_components_base.hpp:158
int observed_data_id_m
Definition density_components_base.hpp:159
Definition density_components_base.hpp:27
size_t get_n_x()
Definition density_components_base.hpp:114
Type & get_observed(size_t i)
Definition density_components_base.hpp:55
std::vector< fims::Vector< Type > * > priors
Definition density_components_base.hpp:40
size_t get_n_expected()
Definition density_components_base.hpp:131
Type & get_observed(size_t i, size_t j)
Definition density_components_base.hpp:80
fims::Vector< Type > * data_expected_values
Definition density_components_base.hpp:38
std::shared_ptr< fims_data_object::DataObject< Type > > observed_values
Definition density_components_base.hpp:32
fims::Vector< Type > * re
Definition density_components_base.hpp:35
fims::Vector< Type > * re_expected_values
Definition density_components_base.hpp:36
std::string input_type
Definition density_components_base.hpp:28
fims::Vector< Type > x
Definition density_components_base.hpp:41
std::string use_mean
Definition density_components_base.hpp:45
fims::Vector< Type > expected_values
Definition density_components_base.hpp:34
Type & get_expected(size_t i)
Definition density_components_base.hpp:98
fims::Vector< Type > expected_mean
Definition density_components_base.hpp:43
FIMSObject struct that defines member types and returns the unique id.
Definition model_object.hpp:25