Calculates Bayesian credible (confidence) and predictive intervals based on parameter sample
getPredictiveIntervals(parMatrix, model, numSamples = 1000, quantiles = c(0.025, 0.975), error = NULL)
parMatrix | matrix of parameter values |
---|---|
model | model / function to calculate predictions. Outcome should be a vector |
numSamples | number of samples to be drawn |
quantiles | quantiles to calculate |
error | function with signature f(mean, par) that generates error expectations from mean model predictions. Par is a vector from the matrix with the parameter samples (full length). f needs to know which of these parameters are parameters of the error function. If supplied, will calculate also predictive intervals additional to credible intervals |
If numSamples is greater than the number of rows in parMatrix, or NULL, or FALSE, or less than 1 all samples in parMatrix will be used.