Learn R Programming

spacom (version 0.9-4)

DescribeAggregate: Descriptives for aggregated contextual indicators

Description

Computes descriptives of spatially weighted aggregated contextual indicators.

Usage

DescribeAggregate(contextual.data,
 context.id,
 contextual.names,
 contextual.weight.matrices,
 nb.resamples = 1000,
 aggregation.functions = "mean",
 confidence.intervals = 0.95,
 individual.weight.names = NULL,
 sample.seed = NULL)

Arguments

contextual.data
A data.frame consisting of micro-level data to generate contextual indicators by aggregation and containing a column named context.id with the context ID variable. This is an individual level dataframe.
context.id
A name of the context ID variable.
contextual.names
A list of names of contextual variables to be weighted.
contextual.weight.matrices
A list of weights to be applied to each variable specified in contextual.names. A weight may be a weights matrix as, for instance computed by WeightMatrix, or NULL
nb.resamples
A number of resamples to be evaluated. By default set to 1000.
aggregation.functions
A list of aggregation functions. Functions take either
  1. 1 argument in which case the corresponding individual design weight isNULL,
  2. 2 arguments in which case the second argument is taken from the correspo
confidence.intervals
A vector of confidence intervals. Defaults to c(.95) which corresponds to 95 %.
individual.weight.names
a list of optional design weights at the individual level used for aggregation (for example, for a weighted mean). List must have same length as contextual.names. May contain NULLs for variables which should not be weighted
sample.seed
Is one of three things
  1. NULL, in which case whatever the current random seed is is used
  2. aninteger, which will be used to set the random seed. This allows reproducible random samples
  3. a saved.Rand

Value

  • An object of class DescribeAggregateOutput-class

Examples

Run this code
# 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