Geoscience Reference
In-Depth Information
Here, districts are identified as neighbors if they share a common border, but
different neighborhood structures can be employed; see, for example, function
dnearneigh() or tri2nb() in package spdep (Bivand 2014 ). The four-level
hierarchical STAR model is then estimated with
R> b <- bayesx(lnp_qm ~ -1 + heat_o2 + heat_o3 + heat_neu1 +
+
heat_neu2 + bath_o1 + bath_o3 + bath_neu1 + bath_neu2 +
+
garage_1 + garage_2 + marker + attic_dum + cellar_dum +
+
terr_dum + sx(c_area) + sx(c_area_plot) + sx(c_age) +
+
sx(c_time_ind) +
+
## Level-2
+
sx(municipal ~ -1 + sx(c_pp_ind) + sx(c_ln_educ) +
+
sx(c_age_ind) + sx(c_comm) + sx(c_ln_dens) +
+
## Level-3
+
sx(district ~ -1 + sx(c_wko_ind) +
+
sx(district, bs="mrf", map=DistrictsNb) +
+
## Level-4
+
sx(county ~ 1, bs="re", data=County),
+
bs="re", data=District),
+
bs="re", data=Municipal),
+ data=HousePrice, method="HMCMC", iterations=120000,
+ step=100, burnin=20000)
where the (possibly) nonlinear smooth terms are per default set up using P-splines
within the smooth term constructor function sx() . The spatially correlated effect
is specified by changing the basis-type argument of sx() to bs = "mrf" and
providing the neighborhood object to argument map . The random effects of the
municipals, districts, and counties are specified with bs = "re" . Here, the first
argument of sx() is a formula that specifies the terms of the random effect
equation. This means that higher-level formulas can be defined within the formula
of the previous levels, representing the multilevel structure of the data. In addition,
the corresponding level-specific data set needs to be supplied to argument data
within sx() .
By setting the number of iterations of the MCMC sampler to 120,000, estimation
takes approximately 2 1/2 min on a Windows system with an Intel i7-3740QM
2.70 GHz processor. A model summary can then be printed by typing
R> summary(b)
which returns the estimation results for all levels. The estimated smooth and random
effects, for example, level 1, can be plotted with
R> plot(b, model=1, term="sx")
For spatial and random effects, the plotting method per default shows the kernel
densities of the mean posterior coefficients. In addition, to further analyze the
correlated or uncorrelated spatial effects, map effect plots can be drawn by supplying
the corresponding boundary map object, for example, for the level-3 correlated
district effect, this is done by
Search WWH ::




Custom Search