richardli / SUMMER

SAE Unit/area Models and Methods for Estimation in R
https://richardli.github.io/SUMMER/
23 stars 6 forks source link

Can not run this demo code. Found error when I write "is.yearly = TRUE" #28

Closed IHHridoy closed 2 years ago

IHHridoy commented 3 years ago

Not run:

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", is.yearly=FALSE, m = 5) out1 <- getSmoothed(fit1) plot(out1, is.subnational=FALSE)

subnational model

fit2 <- smoothDirect(data = data, Amat = DemoMap$Amat, year_label = years.all, year_range = c(1985, 2019), time.model = "rw2", is.yearly=TRUE, m = 5, type.st = 4) out2 <- getSmoothed(fit2) plot(out2, is.subnational=TRUE) pp

richardli commented 3 years ago

Hi Ismail, Thank you for the question. This is due to an incompatibility issue with the latest version of INLA. I have updated the version on github that should be able to work now. If you run install_github('richardli/SUMMER') and restart, it should be able to work.