5 #ifndef BPP_NUMERIC_PROB_INVARIANTMIXEDDISCRETEDISTRIBUTION_H 6 #define BPP_NUMERIC_PROB_INVARIANTMIXEDDISCRETEDISTRIBUTION_H 23 std::unique_ptr<DiscreteDistributionInterface>
dist_;
43 dist_(imdd.dist_->
clone()),
44 invariant_(imdd.invariant_),
46 nestedPrefix_(imdd.nestedPrefix_)
52 dist_.reset(imdd.
dist_->clone());
62 std::string
getName()
const {
return "Invariant"; }
76 dist_->setNumberOfCategories(nbClasses);
87 return (x >= p_ + (1 - p_) * dist_->pProb(invariant_)) ? dist_->qProb((x - p_) / (1 - p_)) : dist_->qProb(x / (1 - p_));
92 return (1 - p_) * dist_->pProb(x) + (x < invariant_ ? 0 :
p_);
97 return (1 - p_) * dist_->Expectation(a) + (a < invariant_ ? 0 :
p_);
105 dist_->setMedian(median);
122 #endif // BPP_NUMERIC_PROB_INVARIANTMIXEDDISCRETEDISTRIBUTION_H double pProb(double x) const
Return the cumulative quantile of the continuous version of the distribution, ie .
double Expectation(double a) const
Return a primitive function used for the expectation of the continuous version of the distribution...
const DiscreteDistributionInterface & variableSubDistribution() const
InvariantMixedDiscreteDistribution(std::unique_ptr< DiscreteDistributionInterface > dist, double p, double invariant=0.)
Build a new InvariantMixedDiscreteDistribution object.
InvariantMixedDiscreteDistribution * clone() const
Create a copy of this object and send a pointer to it.
Partial implementation of the DiscreteDistribution interface.
InvariantMixedDiscreteDistribution & operator=(const InvariantMixedDiscreteDistribution &imdd)
The constraint interface.
void setNamespace(const std::string &prefix)
Set the namespace for the parameter names.
Interface for discrete distribution objects.
std::unique_ptr< DiscreteDistributionInterface > dist_
void setNumberOfCategories(size_t nbClasses)
std::string getName() const
Get the name of the distribution.
InvariantMixedDiscreteDistribution(const InvariantMixedDiscreteDistribution &imdd)
The parameter list object.
AbstractDiscreteDistribution & operator=(const AbstractDiscreteDistribution &adde)
double qProb(double x) const
Return the quantile of the continuous version of the distribution, ie y such that ...
void restrictToConstraint(const ConstraintInterface &c)
Restricts the distribution to the domain where the constraint is respected, in addition of other pred...
void fireParameterChanged(const ParameterList ¶meters)
Notify the class when one or several parameters have changed.
void discretize()
Discretizes the distribution in equiprobable classes.
void updateDistribution()
void setMedian(bool median)
Sets the median value to true to say that the value in a class is proportional to the median value of...
Discrete mixed distribution, with a one-category fixed value (called "invariant") and a user-specifie...
std::string nestedPrefix_
virtual ~InvariantMixedDiscreteDistribution()