if (FALSE) {
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)
fit2 <- smoothDirect(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)
plot(out2, is.yearly=TRUE, is.subnational=TRUE)
hatchPlot(data = subset(out2, is.yearly==FALSE), geo = geo,
variables=c("years"), values = c("median"),
by.data = "region", by.geo = "REGNAME",
lower = "lower", upper = "upper", is.long=TRUE)
}
Run the code above in your browser using DataLab