# creating spatially weighted (with geographical proximity weights, h=50
# and h=200) contextual indicator of risk of war victimization through
# stratified resampling
# load distance matrix and create weights
data(d_geo)
geow_50 <- WeightMatrix(d_geo, bandwidth=50)
geow_200 <- WeightMatrix(d_geo, bandwidth=200)
# load contextual indicator for aggregation
data(traces_event)
# perform DescribeAggregate
wv_g50_200 <- DescribeAggregate(
contextual.data=traces_event,
context.id="area",
contextual.names=c("w_all", "w_all"),
contextual.weight.matrices=list(geow_50, geow_200),
aggregation.functions="weighted.mean",
individual.weight.names="weight",
nb.resamples=5)Run the code above in your browser using DataLab