[R] BayesianTools update prior
Gavan McGrath
gavan.mcgrath at uwa.edu.au
Sun Jul 23 16:08:28 CEST 2017
Hi,
Using the example in ?VSEM in the package BayesianTools I'm attempting to iteratively update the prior but find the plotTimeSeriesResults produces the following errors when I extend the VSEM example in BayesianTools. With the Code below (the errors) I get:
" Error in quantile.default(x, probs = quantiles[i]) :
missing values and NaN's not allowed if 'na.rm' is FALSE"
The error appears to come from the function getPredictiveIntervals, specifically the lines:
for (i in 1:nrow(predDistr)) {
predDistr[i, ] = error(mean = pred[i, ], par = parMatrix[i,
])
}
predInt = getCredibleIntervals(sampleMatrix = predDistr,
quantiles = quantiles)
I suspect lower and upper bounds on the parameters are not being enforced leading to a negative standard deviation being passed to rnorm?.
Any suggestions on how to proceed would be welcome.
Code:
#run the example in ?VSEM first then:
newPrior = createPriorDensity(out, method = "multivariate",
eps = 1e-10,
lower = refPars$lower[parSel],
upper = refPars$upper[parSel])
bayesianSetup <- createBayesianSetup(likelihood = likelihood,
prior = newPrior,
names = rownames(refPars)[parSel] )
out <- runMCMC(bayesianSetup = bayesianSetup, settings = settings)
plotTimeSeriesResults(sampler = out,
model = createPredictions,
observed = obs,
error = createError,
prior = TRUE,
main = "Prior predictive")
[[alternative HTML version deleted]]
More information about the R-help
mailing list