library(tipsae)
# loading toy cross sectional dataset
data("emilia_cs")
# fitting a cross sectional model
fit_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)
# Spatio-temporal model: it might require time to be fitted
if (FALSE) {
# loading toy panel dataset
data("emilia")
# loading the shapefile of the concerned areas
data("emilia_shp")
# fitting a spatio-temporal model
fit_ST <- fit_sae(formula_fixed = hcr ~ x,
domains = "id",
disp_direct = "vars",
type_disp = "var",
domain_size = "n",
data = emilia,
spatial_error = TRUE,
spatial_df = emilia_shp,
domains_spatial_df = "NAME_DISTRICT",
temporal_error = TRUE,
temporal_variable = "year",
max_treedepth = 15,
seed = 0)
}
Run the code above in your browser using DataLab