Description Usage Arguments Details Value Author(s) Examples
This step-2 function should be used to create spatially weighted context data when contextual indicators are aggregate estimates derived from available micro-level survey data. Aggregation functions can be user-defined or chosen among predefined options, which include indicators of central tendency (e.g., spatially weighted mean), dispersion (e.g., spatially weighted standard deviation) and inter-group variability (e.g., spatially weighted Gini coefficient for group inequality). Point estimates can be adjusted by user-defined design weights. Descriptive confidence intervals are computed by way of an ad hoc bootstrap resampling procedure.
1 2 3 4 5 6 7 8 9 10 11 |
contextual.data |
A |
context.id |
The name of the context ID variable. This variable allows matching
contextual units from different data sets ( |
contextual.names |
A |
contextual.weight.matrices |
A |
nb.resamples |
A number of resamples to be evaluated. By default set to 1000. |
aggregation.functions |
A
|
confidence.intervals |
A |
design.weight.names |
a |
sample.seed |
Is one of three things
Defaults to |
additional.args |
For aggregation functions which take additional arguments (that is in
addition to the data to aggregate and design weights), they can be
specified here.
|
verbose |
if |
SpawAggregate
can be used for two similar, yet distinct,
purposes:
Aggregate contextual data and weight it spatially. For this,
make sure to set nb.resamples=0
To resample thecontextual data repeatedly (bootstrap) and
generate a series of aggregated and spatially weighted
data.frames
.
For this, make sure to use a large number of resamples.
The function SpawAggregate
works exactly the same way in either
case, but the output changes. See return value for this
An object of class SpawAggregateOutput-class
if
nb.resamples
is different than 0, a data.frame
in the
contrary case.
Till Junge, Sandra Penic, Mathieu Cossuta, Guy Elcheroth
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 | ## Creating spatially weighted aggregated contextual indicator - spatially weighted
## risk of war victimization across TRACES areas.
## This is step-2 function
## Step 1: Load distance matrix and create weights
data(d_geo)
geow.50 <- WeightMatrix(d_geo, bandwidth=50)
## Step 2: Load dataframe with micro-level data for aggregation and create
## spatially weighted contextual indicator (risk of war victimization weighted by geow.50)
data(traces_event)
wv.g50 <- SpawAggregate(contextual.data=traces_event,
context.id="area.name",
contextual.names="w_all",
contextual.weight.matrices=geow.50,
aggregation.functions="weighted.mean",
design.weight.names="weight",
nb.resamples=5)
## To create non-weighted and spatially weighted (by geow.50) risk of war victimization
wv.nw.g50 <- SpawAggregate(contextual.data=traces_event,
context.id="area.name",
contextual.names=c("w_all","w_all"),
contextual.weight.matrices=list(NULL,geow.50),
aggregation.functions="weighted.mean",
design.weight.names="weight",
nb.resamples=5)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.