Skip to content

Commit

Permalink
Updating single-header
Browse files Browse the repository at this point in the history
  • Loading branch information
gvegayon committed Apr 7, 2024
1 parent 10ebb03 commit 22ecc64
Showing 1 changed file with 46 additions and 13 deletions.
59 changes: 46 additions & 13 deletions epiworld.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1467,6 +1467,13 @@ inline LFMCMCProposalFun<TData> make_proposal_norm_reflective(

}

#ifdef EPI_DEBUG
for (auto & p : params_now)
if (p < lb || p > ub)
throw std::range_error("The parameter is out of bounds.");
#endif


return;

};
Expand Down Expand Up @@ -8749,21 +8756,19 @@ inline void Model<TSeq>::reset() {
}
#endif

}
else
{
for (auto & p : population)
p.reset();
}

#ifdef EPI_DEBUG
for (auto & a: population)
{
if (a.get_state() != 0u)
throw std::logic_error("Model::reset population doesn't match."
"Some agents are not in the baseline state.");
}
#endif
for (auto & p : population)
p.reset();

#ifdef EPI_DEBUG
for (auto & a: population)
{
if (a.get_state() != 0u)
throw std::logic_error("Model::reset population doesn't match."
"Some agents are not in the baseline state.");
}
#endif

if (entities_backup.size() != 0)
{
Expand Down Expand Up @@ -18405,6 +18410,34 @@ inline ModelSEIRDCONN<TSeq> & ModelSEIRDCONN<TSeq>::initial_states(
#ifndef EPIWORLD_MODELS_SIRLOGIT_HPP
#define EPIWORLD_MODELS_SIRLOGIT_HPP


/**
* @brief Template for a Susceptible-Infected-Removed (SIR) model
*
* @details
* In this model, infection and recoveru probabilities are computed
* using a logit model. Particularly, the probability of infection
* is computed as:
*
* \f[
* \frac{1}{1 + \exp\left(-\left(\beta_0 E_i + \sum_{i=1}^{n} \beta_i x_i\right)\right)}
* \f]
*
* where \f$\beta_0\f$ is the exposure coefficient and \f$E_i\f$ is the exposure
* number, \f$\beta_i\f$ are the
* coefficients for the features \f$x_i\f$ of the agents, and \f$n\f$ is the
* number of features. The probability of recovery is computed as:
*
* \f[
* \frac{1}{1 + \exp\left(-\left(\sum_{i=1}^{n} \beta_i x_i\right)\right)}
* \f]
*
* where \f$\beta_i\f$ are the coefficients for the features \f$x_i\f$ of the agents,
* and \f$n\f$ is the number of features.
*
* @param TSeq Type of the sequence (e.g. std::vector, std::deque)

*/
template<typename TSeq = EPI_DEFAULT_TSEQ>
class ModelSIRLogit : public epiworld::Model<TSeq>
{
Expand Down

0 comments on commit 22ecc64

Please sign in to comment.