ggbChooseAges {DDM} | R Documentation |
interactively determine ages to use for estimating coverage
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
ggbChooseAges(codi, minA = 15, maxA = 75, minAges = 8,
exact.ages = NULL, maxit = 15, deaths.summed = FALSE)
Arguments
codi |
|
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 ( |
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
## 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)