The map() function enables to plot maps containing relevant model outputs by accounting for their geographical dimension. The shapefile of the area must be provided via a SpatialPolygonsDataFrame or sf object.
x: An object of class summary_fitsae or benchmark_fitsae.
spatial_df: A object of class SpatialPolygonsDataFrame (spatial polygons object) from sp package or sf from the sf package, accounting for the geographical dimension of the domains.
spatial_id_domains: A character string indicating the name of spatial_df variable containing area denominations, in order to correctly match the areas.
match_names: An encoding two-columns data.frame: the first with the original data coding (domains) and the second one with corresponding spatial_df object labels. This argument has to be specified only if spatial_df object labels do not match the ones provided through the original dataset.
color_palette: A vector with two color strings denoting the extreme bounds of colors range to be used.
quantity: A string indicating the quantity to be mapped. When a summary_fitsae is given as input, it can be selected among "HB_est" (model-based estimates), "SD"(posterior standard deviations) and "Direct_est"(direct estimates). While when a benchmark_fitsae class object is given as input, this argument turns automatically to "Bench_est", displaying the benchmarked estimates.
time: A string indicating the year of interest for the quantities to be treated, in case of temporal or spatio-temporal objects.
style: Method to process the color scale, see tmap documentation.
...: Arguments passed to tm_fill (e.g. n, breaks).
Returns
Atmap object.
Examples
## Not run:library(tipsae)# loading toy datasetdata("emilia_cs")# fitting a modelfit_beta <- fit_sae(formula_fixed = hcr ~ x, data = emilia_cs, domains ="id", type_disp ="var", disp_direct ="vars", domain_size ="n",# MCMC setting to obtain a fast example. Remove next line for reliable results. chains =1, iter =150, seed =0)# check model diagnosticssumm_beta <- summary(fit_beta)# load shapefile of concerned areasdata("emilia_shp")# plot the map using model diagnostics and areas shapefilemap(x = summ_beta, spatial_df = emilia_shp, spatial_id_domains ="NAME_DISTRICT")## End(Not run)
See Also
summary.fitsae to produce the input object and SpatialPolygonsDataFrame to manage the shapefile.