1 #ifndef HAZARDFUNCTIONFORMATIONSIMPLE_H
3 #define HAZARDFUNCTIONFORMATIONSIMPLE_H
12 HazardFunctionFormationSimple(
const Person *pPerson1,
const Person *pPerson2,
double tr,
13 double a0,
double a1,
double a2,
double a3,
double a4,
14 double a5,
double Dp,
double b);
15 ~HazardFunctionFormationSimple();
21 double getLnB()
const;
24 double getE(
double t0)
const;
26 const Person *m_pPerson1;
27 const Person *m_pPerson2;
28 const double m_tr, m_a0, m_a1, m_a2, m_a3, m_a4, m_a5, m_Dp, m_b;
31 inline double HazardFunctionFormationSimple::getLnB()
const
33 double Pi = m_pPerson1->getNumberOfRelationships();
34 double Pj = m_pPerson2->getNumberOfRelationships();
35 double tBi = m_pPerson1->getDateOfBirth();
36 double tBj = m_pPerson2->getDateOfBirth();
38 double lnB = m_a0 + m_a1*Pi + m_a2*Pj + m_a3*std::abs(Pi-Pj) - m_a4*(tBi + tBj)/2.0
39 +m_a5*std::abs(-tBi+tBj-m_Dp) - m_b*m_tr;
44 inline double HazardFunctionFormationSimple::getB()
const
46 return std::exp(getLnB());
49 inline double HazardFunctionFormationSimple::getC()
const
51 double C = m_a4 + m_b;
56 inline double HazardFunctionFormationSimple::getE(
double t0)
const
58 double Pi = m_pPerson1->getNumberOfRelationships();
59 double Pj = m_pPerson2->getNumberOfRelationships();
60 double tBi = m_pPerson1->getDateOfBirth();
61 double tBj = m_pPerson2->getDateOfBirth();
63 double E = std::exp(m_a0 + m_a1*Pi + m_a2*Pj + m_a3*std::abs(Pi-Pj) + m_a4*(t0 - (tBi + tBj)/2.0)
64 +m_a5*std::abs(-tBi+tBj-m_Dp) + m_b*(t0-m_tr));
68 #endif // HAZARDFUNCTIONFORMATIONSIMPLE_H
Abstract base class which can be used for a hazard.
Definition: hazardfunction.h:18
virtual double calculateInternalTimeInterval(double t0, double dt)=0
Map the real-world time dt to an internal time interval.
virtual double solveForRealTimeInterval(double t0, double Tdiff)=0
For the specified internal time interval Tdiff, calculate the corresponding real-world time interval...
virtual double evaluate(double t)=0
Evaluate the hazard at time t.