Description Usage Arguments Value Author(s) References Examples
This step4 function uses the contextual residuals of (spatially weighted) multilevel models to estimate the spatial dependency left unexplained by the model. The spatial dependency is operationalised by Moran's I coefficient for spatial autocorrelation, which can be recalculated for a range of different bandwidth values (which, in a similar way to spatial weights used for the creation of the context data, allow to parametrise the scale at which spatial dependency is being estimated). The part of explained spatial dependency can be obtained by comparison with the spatial dependency of the interceptonly, or with any other reference model, at the same bandwidth value.
1 2 3 4 5 6  MLSpawResidMoran(ml.spaw.obj,
distance.matrix,
bandwidths,
kernel = NULL,
confidence.intervals = c(0.95),
verbose = TRUE)

ml.spaw.obj 

distance.matrix 
square matrix of dimension n by n, where n is the number of contextual units. 
bandwidths 

kernel 
function applied to the distance matrix. By default w_ij = f(d, h) = (1/2)^((d_ij/h)^2) is used, where w_ij, d_ij, h are elements of the weight matrix W, of the distance matrix W and the bandwidth h. Usersupplied kernel functions have to take 2 arguments and return a matrix of the same dimension as the first argument. 
confidence.intervals 

verbose 
if 
A matrix
containing Moran's I's
Till Junge, Sandra Penic, Guy Elcheroth
Elcheroth, G., Penic, S., Fasel, R., Giudici, F., Glaeser, S., Joye, D., Le Goff, J.M., Morselli, D., & Spini, D. (2012). Spatially weighted context data: a new approach for modelling the impact of collective experiences. LIVES Working Papers, 19.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67  # Residual spatial autocorrelation
## It is step4 function
## for residuals from ResampleAggregateSpawML
## Data preparation
## load individual level data, remove collective guilt assignment for the
## data frame, and remove NA's
data(traces_ind)
traces_ind < traces_ind[,7]
traces_ind < na.exclude(traces_ind)
## load contextual indicator for aggregation
data(traces_event)
## load precise contextual indicator
data(homog_census)
## load distance matrix
data(d_geo)
## Step 1: Create spatial weights
geow.100 < WeightMatrix(d_geo, bandwidth=100)
## Step 2: Compute spatially weighted aggregated contextual indicator
wv.agg.100 < SpawAggregate(
contextual.data = traces_event,
context.id="area.name",
contextual.names = "w_all",
contextual.weight.matrices=geow.100,
nb.resamples=5,
aggregation.functions="weighted.mean",
design.weight.names="weight",
sample.seed=1)
## rename weighted variable name so it reflects the used weighting
## matrix
names(wv.agg.100) < "w_all.100"
## Step 3: Perform ResampleMLSpawAggregate
acc_w_100 <
ResampleMLSpawAggregate(
individual.level.data=traces_ind,
context.id="area.name",
formula=cg_acc ~ victim_d + comb_d + male + age_1990 + high_school +
higher_edu + (1area.name) + w_all.100,
aggregates=wv.agg.100,
precise.data=NULL)
## Step 4: Perform MLSpawResidMoran for bandwidths 25, 50, 100, 200
## Not run:
MI_acc < MLSpawResidMoran(ml.spaw.obj=acc_w_100,
distance.matrix=d_geo,
bandwidths=c(25,50,100,200))
## End(Not run)
## The results can be used for plotting spatial variogram
## See plot() and par() for details
## Not run:
plot(MI_acc[,1], xaxt="n", xlab="Bandwidth values", ylab="Moran's I", type="b")
axis(side=1, at=1:nrow(MI_acc), labels=rownames(MI_acc))
## End(Not run)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.