The function computes coverage, i.e. the ratio of observed data fitted within the given probability intervals of the predictive posterior distribution of the double logistic function, as well as the root mean square error and mean absolute error of the simulation.
tfr.dl.coverage(sim.dir, pi = c(80, 90, 95), burnin = 2000, verbose = TRUE)
List with the following components:
Vector of the coverage, one element per probability interval. For each pi
, it is the ratio of the number of observed data points that fall within the probability interval of the posterior distribution over the total number of data points, i.e. TFR for all countries and historical time periods.
Matrix corresponding to the coverage computed per time period. (Rows correspond to probability intervals, columns correspond to time.) It is derived like total.coverage
except that both, the nominator and denominator, contain only data points belonging to the corresponding time period.
Matrix corresponding to the coverage computed per country. (Rows correspond to probability intervals, columns correspond to countries.) It is derived like total.coverage
except that both, the nominator and denominator, contain only data points belonging to the corresponding country.
Root mean square error as \(\sqrt{(1/n\sum(x-m)^2)}\) where \(x\) are observed data points, \(m\) is the mean of the posterior distribution and \(n\) is the number of data points. Here the sum is taken over all countries and historical time periods.
Like total.rmse
except that each time period is considered separately.
Like total.rmse
except that each country is considered separately.
Mean absolute error as \(1/n\sum|x-m|\) where \(x\) are observed data points, \(m\) is the median of the posterior distribution and \(n\) is the number of data points. Here the sum is taken over all countries and historical time periods.
Like total.mae
except that each time period is considered separately.
Like total.mae
except that each country is considered separately.
\(T \times C\) matrix (with \(T\) being the number of time periods and \(C\) being the number of countries), containing the predictive CDF of the observation, i.e. the quantile of each data point within the predictive posterior distribution.
0-1 \(T \times C\) matrix indicating if the corresponding data point was included in the goodness of fit computation. Zeros indicate missing historical values.
Directory with the MCMC simulation results. If a prediction and its corresponding thinned MCMCs are available in the simulation directory, those are taken for assessing the goodness of fit.
Probability interval. It can be a single number or an array.
Burnin. Only relevant if sim.dir
does not contain thinned chains.
Logical switching log messages on and off.
Hana Sevcikova
DLcurve.plot
if (FALSE) {
sim.dir <- file.path(find.package("bayesTFR"), "ex-data", "bayesTFR.output")
tfr <- get.tfr.mcmc(sim.dir)
# Note that this simulation is a toy example and thus has not converged.
gof <- tfr.dl.coverage(sim.dir)
gof$time.coverage
DLcurve.plot(tfr, country=608, predictive.distr=TRUE, pi=c(80, 90, 95))
}
Run the code above in your browser using DataLab