Extract posterior summaries of random effects
getDiag(
inla_mod,
field = c("space", "time", "spacetime")[1],
CI = 0.95,
draws = NULL,
nsim = 1000,
...
)
List of diagnostic plots
output from smoothDirect
or smoothCluster
which random effects to plot. It can be one of the following: space, time, and spacetime.
Desired level of credible intervals
Posterior samples drawn from the fitted model. This argument allows the previously sampled draws (by setting save.draws to be TRUE) be used in new aggregation tasks.
number of simulations, only applicable for the cluster-level model space-time interaction terms when random slopes are included.
Unused arguments, for users with fitted object from the package before v1.0.0, arguments including Amat, year_label, and year_range can still be specified manually.
Zehang Richard Li
if (FALSE) {
data(DemoMap)
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 <- smoothDirect(data = data, geo = DemoMap$geo, Amat = DemoMap$Amat,
year_label = years.all, year_range = c(1985, 2019),
rw = 2, is.yearly=FALSE, m = 5)
random.time <- getDiag(fit1, field = "time")
random.space <- getDiag(fit1, field = "space")
random.spacetime <- getDiag(fit1, field = "spacetime")
}
Run the code above in your browser using DataLab