Skip to content

Commit

Permalink
the residual pl IET function was not formulated correctly....
Browse files Browse the repository at this point in the history
  • Loading branch information
arashbm committed Nov 6, 2024
1 parent 9d6ff6f commit 1fd6775
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/distributions.tpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,13 @@ namespace reticula {
template <std::uniform_random_bit_generator Generator>
RealType residual_power_law_with_specified_mean<RealType>::operator()(
Generator& g) const {
std::uniform_real_distribution<RealType> dist;
return _x_min*std::pow((1.0 - dist(g)), 1.0/(1.0 - _exponent));
auto u = std::uniform_real_distribution<RealType>{}(g);
if (u*_mean < _x_min)
return u*_mean;

return _x_min * std::pow(
(1.0 - dist(g)) * (_exponent - 1.0),
1.0 / (_exponent - 2.0));
}

template <std::floating_point RealType>
Expand All @@ -74,7 +79,7 @@ namespace reticula {
return _mean;
}

// hawkes_univariate_exponential
// Hawkes_univariate_exponential
template <std::floating_point RealType>
hawkes_univariate_exponential<RealType>::hawkes_univariate_exponential(
RealType mu, RealType alpha, RealType theta, RealType phi) :
Expand Down

0 comments on commit 1fd6775

Please sign in to comment.