plotBAPC | R Documentation |
Function to plot age-specific and/or agestandardized projections of a Bayesian age-period-cohort model
generated using BAPC
using a fanplot.
plotBAPC(APCList, scale = 10^5, type="ageSpecProj", probs = c(0.025, seq(0.05, 0.95, by=0.05), 0.975), start=NULL, showdata = TRUE, mfrow = NULL, col.fan =sequential_hcl, obs.pch=21, obs.col="white", obs.bg="black", obs.lwd=2, obs.cex=1, ln=NULL, ...)
APCList |
|
scale |
Scaling factor for the incidence/mortality rates. |
type |
String indicating what should be plotted:
|
probs |
Probabilities related to percentiles or prediction intervals
to be plotted. These values
control the number of shades used in the 'fan'.
These must be between 0 and 1.
Percentiles greater than 0.5, if not given, are
automatically calculated as 1-'p', to ensure symmetric fan.
Values can be non-integers. See function |
start |
If NULL results for all periods are plotted. Otherwise 'start' must be
a string representing the year to start plotting. It must be an
element of |
showdata |
Boolean indicating whether observed data points should be added to the plot. Default: TRUE. |
mfrow |
A vector of the form 'c(nr, nc)'. Subsequent figures will be drawn in an 'nr'-by-'nc' array on the device by _columns_ ('mfcol'), or _rows_ ('mfrow'), respectively. |
col.fan |
Palette of colours used in the 'fan'. See fucntion |
obs.pch |
Plotting character, i.e. symbol, to be used when showing observed values. See options pch in points. |
obs.col |
Color used when observed data are plotted. |
obs.bg |
Background (fill) color for the open plot symbols given by 'obs.pch = 21:25'. |
obs.lwd |
Line width for drawing observed symbols. |
obs.cex |
Character expansion when drawing observed symbols. |
ln |
Equivalent to option 'ln' of function |
... |
Further arguments passed to |
A plot illustrating age-specific or age-standardized projections/fitted values.
Andrea Riebler
## Not run: if(requireNamespace("INLA", quietly = TRUE)) { require(INLA) data(FemLCSweden) data(FemPYSweden) data(whostandard) lc_sweden <- APCList(FemLCSweden, FemPYSweden, gf=5) result <- BAPC(lc_sweden, predict=list(npredict=10, retro=TRUE), verbose=FALSE, stdweight=whostandard[6:17,2]) plotBAPC(result, scale=10^5, type="ageSpecProj", showdata=TRUE) ## Assume the data for 2000 to 2010 are not observed ## (projection results are the same as above) FemLCSweden[51:60,] <- NA lc_sweden <- APCList(FemLCSweden, FemPYSweden, gf=5) result <- BAPC(lc_sweden, predict=list(npredict=10, retro=FALSE), verbose=FALSE, stdweight=whostandard[6:17,2]) plotBAPC(result, scale=10^5, type="ageSpecProj", showdata=TRUE) } ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.