fetchCoverage: Obtain the coverage ratio for a dataset.

View source: R/query-functions.R

fetchCoverageR Documentation

Obtain the coverage ratio for a dataset.

Description

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.

Usage

fetchCoverage(filename, dataset)

Arguments

filename

The filename used by the estimate function.

dataset

The name of the dataset to be used as the numerator of the ratios.

Details

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.

Value

An object of class Values.

See Also

Coverage ratios can also be calculated by a couple of calls to fetch.

Examples

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)

StatisticsNZ/demest documentation built on Nov. 2, 2023, 7:56 p.m.