TABLE OF CONTENTS


CmiscUtils/EvalNknotsPrior [ Functions ]

NAME

    EvalNknotsPrior --- evaluate the prior on the number of knots

FUNCTION

Compute the prior probability of a given number of knots for a curve. Used in MH_BDM.

SYNOPSIS

1544 static inline double EvalNknotsPrior( int nknots, curveP theCurve)

INPUTS

     nknots       the value at which the prior should be evaluated
     theCurve     a CCurve structure with SplineNknotsPrior and SplineNknotsHyper components

OUTPUTS

     p        prior probability of nknots for a distribution given by SplineNknotsPrior

SOURCE

1548 {
1549     double dnknots = (double) nknots;
1550     // fetch the prior probability distribution
1551     nknotsprior prior = theCurve->SplineNknotsPrior;
1552     // evaluate different types of distribution
1553     if(prior==PrPoisson)  // Poisson prior
1554         return dpois( dnknots, theCurve->SplineNknotsHyper[0], 0);
1555     if(prior==PrGeometric)  // Geometric prior
1556         return dgeom( dnknots, theCurve->SplineNknotsHyper[0], 0);
1557     if(prior==PrPoissonMix)  // Poisson mixture
1558         return 0.5*( dpois( dnknots, theCurve->SplineNknotsHyper[0], 0) +
1559                 dpois( dnknots, theCurve->SplineNknotsHyper[0], 0));
1560     if(prior==PrNegBin)  // Negative binomial
1561         return dnegbin( dnknots, theCurve->SplineNknotsHyper[0], theCurve->SplineNknotsHyper[1]);
1562     if(prior==PrPower)  // Power
1563         return pow( dnknots, theCurve->SplineNknotsHyper[0]);
1564 }