TABLE OF CONTENTS


splineUtils/nknotsPrior [ Functions ]

NAME

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

FUNCTION

In the course of RJMCMC for selecting the number of knots, the prior probability of a given number of knots must be evaluated.

SYNOPSIS

1255 nknotsPrior <- function(x, curve)

INPUTS

    x      number of knots at which to evaluate the prior
    curve  an RCurve structure, with spline.nknots.prior and spline.nknots.hyper components

OUTPUTS

SOURCE

1258 {
1259     if(curve$spline.nknots.prior == "poisson")
1260         return(dpois(x, curve$spline.nknots.hyper))
1261     if(curve$spline.nknots.prior == "geometric")
1262         return(dgeom(x, curve$spline.nknots.hyper))
1263     if(curve$spline.nknots.prior == "poissonmix")
1264         return(mean(dpois(x, curve$spline.nknots.hyper)))
1265     if(curve$spline.nknots.prior == "negbin")
1266         return(dnegbin(x, curve$spline.nknots.hyper[1], curve$spline.nknots.hyper[2]))
1267     if(curve$spline.nknots.prior == "power")
1268         return(x^curve$spline.nknots.hyper)
1269 }