Learn R Programming

SUMMER (version 0.3.0)

fitINLA: Fit space-time smoothing models to mortality rates

Description

Fit space-time smoothing models to mortality rates

Usage

fitINLA(data, Amat, geo, formula = NULL, rw = 2, is.yearly = TRUE,
  year_label, year_range = c(1980, 2014), m = 5, na.rm = TRUE,
  priors = NULL, type.st = 1, hyper = c("pc", "gamma")[1],
  pc.u = 1, pc.alpha = 0.01, pc.u.phi = 0.5, pc.alpha.phi = 2/3,
  a.iid = NULL, b.iid = NULL, a.rw = NULL, b.rw = NULL,
  a.icar = NULL, b.icar = NULL, options = list(dic = T, mlik = T, cpo
  = T, openmp.strategy = "default"), verbose = FALSE)

Arguments

data

Combined dataset

Amat

Adjacency matrix for the regions

geo

Geo file

formula

INLA formula. See vignette for example of using customized formula.

rw

Take values 1 or 2, indicating the order of random walk.

is.yearly

Logical indicator for fitting yearly or period model.

year_label

string vector of year names

year_range

Entire range of the years (inclusive) defined in year_label.

m

Number of years in each period.

na.rm

Logical indicator of whether to remove rows with NA values in the data. Default set to TRUE.

priors

priors from simhyper

type.st

type for space-time interaction

hyper

which hyperpriors to use. Default to be using the PC prior ("pc").

pc.u

hyperparameter U for the PC prior on precisions.

pc.alpha

hyperparameter alpha for the PC prior on precisions.

pc.u.phi

hyperparameter U for the PC prior on the mixture probability phi in BYM2 model.

pc.alpha.phi

hyperparameter alpha for the PC prior on the mixture probability phi in BYM2 model.

a.iid

hyperparameter for i.i.d random effects.

b.iid

hyperparameter for i.i.d random effects.

a.rw

hyperparameter for RW 1 or 2 random effects.

b.rw

hyperparameter for RW 1 or 2random effects.

a.icar

hyperparameter for ICAR random effects.

b.icar

hyperparameter for ICAR random effects.

options

list of options to be passed to control.compute() in the inla() function.

verbose

logical indicator to print out detailed inla() intermediate steps.

Value

INLA model fit using the provided formula, country summary data, and geographic data

See Also

getDirect

Examples

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

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

#  national model
years.all <- c(years, "15-19")
fit1 <- fitINLA(data = data, geo = NULL, Amat = NULL, 
  year_label = years.all, year_range = c(1985, 2019), 
  rw = 2, is.yearly=FALSE, m = 5)
out1 <- getSmoothed(fit1)
plot(out1, is.subnational=FALSE)

#  subnational model
fit2 <- fitINLA(data = data, geo = geo, Amat = mat, 
  year_label = years.all, year_range = c(1985, 2019), 
  rw = 2, is.yearly=TRUE, m = 5, type.st = 4)
out2 <- getSmoothed(fit2, Amat = mat)
plot(out2, is.yearly=TRUE, is.subnational=TRUE)


# }

Run the code above in your browser using DataLab