ggbChooseAges: interactively determine ages to use for estimating coverage

Description Usage Arguments Details Value Examples

View source: R/ggb.R

Description

In a spreadsheet one would typically set up the GGB method to produce a plot that updates as the user changes the age range. This function implements that kind of work flow. This will be intuitive for spreadsheet users, but it does not scale well. Imagine you have 200 territorial units, then you would not want to repeat this task. ggb() does the same thing automatically. You can compare the age range you select manually with the one given back by ggb() as a diagnostic, for instance. To set up the plot device, just give a single year/region/sex of data. By default it will give the RMSE-optimized age range to start with, but you can specify a vector of exact ages to use as well. All points are plotted, with a fitted line that has been set to a subset of the points, which is plotted in a different color. You can click any point to change the age range, and the plot updates accordingly, up to a maximum of 15 clicks so you don't waste your time. You can stop the plot by either clicking on the graphics device outside the plot area or clicking out the 15 tries (or more if you increase maxit).

Usage

1
2
ggbChooseAges(codi, minA = 15, maxA = 75, minAges = 8,
  exact.ages = NULL, maxit = 15, deaths.summed = FALSE)

Arguments

codi

data.frame with columns, $pop1, $pop2, $deaths, $date1, $date2, and $age.

minA

the lowest age to be included in search

maxA

the highest age to be included in search (the lower bound thereof)

minAges

the minimum number of adjacent ages to be used in estimating

exact.ages

optional. A user-specified vector of exact ages to use for coverage estimation.

maxit

the maximum number of clicks you can take. Default 15.

deaths.summed

logical. is the deaths column given as the total per age in the intercensal period (TRUE). By default we assume FALSE, i.e. that the average annual was given.

Details

If you want to send the results of this into ggb(), you can do so by setting Exact.ages to seq(lower,upper,by=5), where $lower, and $upper are the results returned from ggbChooseAges() after you're done manually determining the age range.

Value

data.frame containing elements $coverage, $lower, $upper, and ages.

Examples

1
2
3
4
5
6
7
## Not run: 
# for interactive sessions only
# *click points to adjus age range used (yellow)
# *click in margin to stop and return coverage results
ggbChooseAges(Moz)

## End(Not run)

DDM documentation built on May 2, 2019, 6:16 a.m.

Related to ggbChooseAges in DDM...