Learn R Programming

SUMMER (version 0.2.1)

plot.projINLA: Plot projection output.

Description

Plot projection output.

Usage

# S3 method for projINLA
plot(x, years_label = c("85-89", "90-94", "95-99", "00-04",
  "05-09", "10-14", "15-19"), years_med = c(1987, 1992, 1997, 2002, 2007,
  2012, 2017), is.yearly = TRUE, is.subnational = TRUE, proj_year = 2015,
  ...)

Arguments

x

output from projINLA

years_label

labels for the periods

years_med

labels for the middle years in each period

is.yearly

logical indicator of whether the data contains yearly estimates

is.subnational

logical indicator of whether the data contains subnational estimates

proj_year

The first year where projections are made, i.e., where no data are available.

...

optional arguments, see details

Details

Note that arguments after ... must match exactly.

  • years_labelstring of year labels, defaults to c("85-89", "90-94", "95-99", "00-04", "05-09", "10-14", "15-19")

  • proj_yearprojection year as numeric, defaults to 2015

  • years_med median of year intervals, defaults to c(1987, 1992, 1997, 2002, 2007, 2012, 2017)

  • is.yearlyindicator for yearly model, defaults to TRUE

  • is.subnationalindicator for subnational model, defaults to TRUE

Examples

Run this code
# NOT RUN {
data(DemoData)
deta(DemoMap)
years <- levels(DemoData[[1]]$time)

# obtain direct estimates
data <- countrySummary_mult(births = DemoData, 
years = years, idVar = "id", 
regionVar = "region", timeVar = "time", 
clusterVar = "~clustid+id", 
ageVar = "age", weightsVar = "weights", 
geo.recode = NULL)

# obtain maps
geo <- DemoMap$geo
mat <- DemoMap$Amat

# Simulate hyper priors
priors <- simhyper(R = 2, nsamp = 1e+05, nsamp.check = 5000, Amat = mat, only.iid = TRUE)

# combine data from multiple surveys
data <- aggregateSurvey(data)

# Model fitting with INLA
years.all <- c(years, "15-19")
fit <- fitINLA(data = data, geo = geo, Amat = mat, 
year_names = years.all, year_range = c(1985, 2019), 
priors = priors, rw = 2, is.yearly=TRUE, 
m = 5, type.st = 4)
# Projection
out <- projINLA(fit, Amat = mat, is.yearly = TRUE)
plot(out, is.yearly=TRUE, is.subnational=TRUE) + ggplot2::ggtitle("Subnational yearly model")

# }

Run the code above in your browser using DataLab