# 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)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab