getSmoothed | R Documentation |
Extract smoothed estimates.
getSmoothed( inla_mod, nsim = 1000, weight.strata = NULL, weight.frame = NULL, verbose = FALSE, mc = 0, include_time_unstruct = FALSE, CI = 0.95, draws = NULL, save.draws = FALSE, include_subnational = TRUE, ... )
inla_mod |
output from |
nsim |
number of simulations, only applicable for the cluster-level model. The smooth direct model always draws 1e5 samples from the marginal distribution since the computation is faster. |
weight.strata |
a data frame with two columns specifying time and region, followed by columns specifying proportion of each strata for each region. This argument specifies the weights for strata-specific estimates on the probability scale. |
weight.frame |
a data frame with three columns, years, region, and the weight of each frame for the corresponding time period and region. This argument specifies the weights for frame-specific estimates on the logit scale. Notice this is different from weight.strata argument. |
verbose |
logical indicator whether to print progress messages from inla.posterior.sample. |
mc |
number of monte carlo draws to approximate the marginal prevalence/hazards for binomial model. If mc = 0, analytical approximation is used. The analytical approximation is invalid for hazard modeling with more than one age groups. |
include_time_unstruct |
Indicator whether to include the temporal unstructured effects (i.e., shocks) in the smoothed estimates from cluster-level model. The argument only applies to the cluster-level models (from |
CI |
Desired level of credible intervals |
draws |
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. |
save.draws |
Logical indicator whether the raw posterior draws will be saved. Saved draws can be used to accelerate aggregations with different weights. |
include_subnational |
logical indicator whether to include the spatial and space-time interaction components in the smoothed estimates. If set to FALSE, only the main temporal trends are returned. |
... |
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. |
A data frame or a list of data frames of S3 class SUMMERproj, which contains the smoothed estimates.
Zehang Richard Li
plot.SUMMERproj
## 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 <- smoothDirect(data = data, 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 <- smoothDirect(data = data, 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) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.