Learn R Programming

bayesTFR (version 2.1-1)

tfr.dl.coverage: Goodness of Fit of the Double Logistic Function

Description

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 of the simulation.

Usage

tfr.dl.coverage(sim.dir, pi = c(80, 90, 95), burnin = 2000, verbose = TRUE)

Arguments

Value

List with the following components:total.coverageVector 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.time.coverageMatrix corresponding to the coverage computed per time period. (Rows correspond to probability intervals, columns correspond to time.) It is derived as total.coverage but both, the nominator and denominator contain only data points belonging to the corresponding time period.country.coverageMatrix corresponding to the coverage computed per country. (Rows correspond to probability intervals, columns correspond to countries.) It is derived as total.coverage but both, the nominator and denominator contain only data points belonging to the corresponding country.total.rmseRoot mean square error as $\sqrt(1/n\sum(x-m)^2)$ 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.time.rmseAs total.rmse but each time period is considered separately.country.rmseAs total.rmse but each country is considered separately.n0-1 matrix of time periods times countries, which indicates if the corresponding data point was included in the goodness of fit computation. Zeros indicate missing historical values.

See Also

DLcurve.plot

Examples

Run this code
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