[R] BayesianTools update prior

Bert Gunter bgunter.4567 at gmail.com
Sun Jul 23 17:07:29 CEST 2017


If you fail to get a satisfactory reply here because this is a
specialized package, you should probably contact the maintainer (see
?maintainer), who may not monitor this list.

Cheers,
Bert


Bert Gunter

"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Sun, Jul 23, 2017 at 7:08 AM, Gavan McGrath <gavan.mcgrath at uwa.edu.au> wrote:
> 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]]
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list