if (FALSE) {
years <- levels(DemoData[[1]]$time)
# 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 <- smoothDirect(data = data, Amat = NULL,
year.label = years.all, year.range = c(1985, 2019),
time.model = 'rw2', m = 5, control.compute = list(config =TRUE))
out1 <- getSmoothed(fit1)
plot(out1)
# subnational model
fit2 <- smoothDirect(data = data, Amat = DemoMap$Amat,
year.label = years.all, year.range = c(1985, 2019),
time.model = 'rw2', m = 5, type.st = 4)
out2 <- getSmoothed(fit2)
plot(out2)
# subnational space-only model for one period
fit3 <- smoothDirect(data = subset(data, years == "10-14"),
time.model = NULL, Amat = DemoMap$Amat)
out3 <- getSmoothed(fit3)
plot(out3, plot.CI = TRUE)
}
Run the code above in your browser using DataLab