View source: R/query-functions.R
fetchCoverage | R Documentation |
After running estimateCounts
or estimateAccount
,
calculate the coverage ratio for a particular dataset. The coverage
ratio is the ratio between counts in the dataset and counts in the
series being modelled. For instance, if the dataset is the census
and the series being modelled is population, then the coverage ratio
is the number of people (of a given age, sex, geography, etc) measured
in the census, divided by the number of people in the true population.
fetchCoverage(filename, dataset)
filename |
The filename used by the estimate function. |
dataset |
The name of the dataset to be used as the numerator of the ratios. |
Only the name of the dataset is needed. With estimateCounts
,
the denominator is always y
. With estimateAccount
,
the denominator depends on the data model used for the particular dataset.
Note that a coverage ratio is a finite-population estimate, in that it is
defined in terms of actual (potentially observable) numbers of people or
events, rather than underlying (unobservable) parameters. Some data models,
such as Poisson models, yield rates or probabilities that can be
interpreted as super-population counterparts of coverage ratios.
These can be extracted using function fetch
.
An object of class Values
.
Coverage ratios can also be calculated by a couple of calls
to fetch
.
nat <- demdata::sim.admin.nat
health <- demdata::sim.admin.health
survey <- demdata::sim.admin.survey
nat <- Counts(nat, dimscales = c(year = "Points"))
health <- Counts(health, dimscales = c(year = "Points"))
survey <- Counts(survey)
y <- health + 10
model <- Model(y ~ Poisson(mean ~ age + sex + region,
useExpose = FALSE))
dataModels <- list(Model(nat ~ PoissonBinomial(prob = 0.98)),
Model(health ~ Poisson(mean ~ age)),
Model(survey ~ Binomial(mean ~ 1)))
datasets <- list(nat = nat, health = health, survey = survey)
filename <- tempfile()
## in a real example, nBurnin and nSim would be much larger
## Not run:
estimateCounts(model = model,
y = y,
dataModels = dataModels,
datasets = datasets,
filename = filename,
nBurnin = 5,
nSim = 5,
nThin = 2,
nChain = 2,
parallel = FALSE)
cover.nat <- fetchCoverage(filename, "nat")
summary(cover.nat)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.