TABLE OF CONTENTS
initRoutine/nknotsPriorMean [ Functions ]
NAME
nknotsPriorMean --- compute the prior mean of the number of knots of a curve
FUNCTION
If adaptive selection is used, the algorithm initializes the number of spline knots at the prior mean. This function computes the prior mean number of spline knots for different priors
SYNOPSIS
1224 nknotsPriorMean <- function(curve)
INPUTS
curve an RCurve structure
OUTPUTS
the prior mean number of knots, for type spline.nknots.prior and parameters spline.nknots.hyper
SOURCE
1227 { 1228 if(curve$spline.nknots.prior == "poisson") 1229 return(curve$spline.nknots.hyper) 1230 if(curve$spline.nknots.prior == "geometric") 1231 return(round(1 / curve$spline.nknots.hyper)) 1232 if(curve$spline.nknots.prior == "poissonmix") 1233 return(round(mean(curve$spline.nknots.hyper))) 1234 if(curve$spline.nknots.prior == "negbin") 1235 return(round(weighted.mean(1:curve$spline.maxoccknots, 1236 dnegbin(1:curve$spline.maxoccknots, curve$spline.nknots.hyper[1], 1237 curve$spline.nknots.hyper[2])))) 1238 if(curve$spline.nknots.prior == "power") 1239 return(round(weighted.mean(1:curve$spline.maxoccknots, 1240 (1:curve$spline.maxoccknots)^curve$spline.nknots.hyper))) 1241 }