ExploreMLSpawExact: Exploratory multilevel analysis with spatially weighted...

Description Usage Arguments Details Value Author(s) References Examples

Description

These exploratory functions provide fast-track procedures, which condense steps 1 to 3. On the basis of precise contextual measures and/or micro-level survey data for estimating contextual indicators, a distance matrix between contextual units, and individual outcomes and (optional) predictor variables, it directly generates point estimates for regression coefficients of a user-defined multilevel model, for a range of different bandwidth values. This function can be used to first explore the scale of relevant contextual effects, before parametrising the model more precisely, calculating (computationally expensive) confidence intervals and estimating spatial dependency for specific models, on a step-by-step basis.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
ExploreMLSpawExact(individual.level.data,
 contextual.name,
 context.id,
 formula,
 distance.matrix,
 multilevel.bandwidths,
 precise.data,
 kernel = NULL,
 verbose = TRUE)

ExploreMLSpawAggregate(individual.level.data,
 contextual.name,
 contextual.data,
 context.id, formula,
 distance.matrix,
 multilevel.bandwidths,
 design.weight.names = NULL,
 aggregation.function = "weighted.mean",
 kernel = NULL,
 additional.args = NULL,
 verbose = TRUE)

Arguments

individual.level.data

A data.frame containing the individual level predictor and outcome variables. The data must be numeric (logical, integer, or plain numeric). There must not be any missing values, NaNs, NULLs or NAs.

contextual.name

A name of contextual variable to be weighted.

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. The data must be numeric (logical, integer, or plain numeric). There must not be any missing values, NaNs, NULLs or NAs. By default set to NULL.

context.id

The name of the context ID variable. This variable allows matching contextual units from different data sets (contextual.data, individual.level.data, distance.matrix). Values can by of any type but need to be defined consitently across data sets.

formula

Formula description of the model.The formula is handed down to lmer function of the package lme4. Refer to the documentation of lmer for details.

distance.matrix

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

multilevel.bandwidths

A vector of scalar numeric values specifying the bandwidth h

precise.data

A data.frame containing the precise contextual data.There must not be any missing values, NaNs, NULLs or NAs. By default set to NULL.

design.weight.names

A name of optional design weight at the individual level used for aggregation (for example, for a weighted mean). By default set to NULL.

aggregation.function

A name of aggregation function. Function takes either

  1. 1 argument in which case the corresponding individual design weight is NULL,

  2. 2 arguments in which case the second argument is taken from the corresponding individual design weight. Defaults to "mean".

kernel

A function applied to the distance matrix. By default NULL, in which case the kernel function

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 D and the bandwidth h. User-supplied kernel functions have to take 2 arguments and return a matrix of the same dimension as the first argument.

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. additional.args defaults to NULL

verbose

if TRUE, progress information and an estimate of the remaining computing time is shown at the screen. Defaults to TRUE

Details

ExploreMLSpawExact performs exploratory multilevel analysis with a precise spatially weighted contextual indicator. ExploreMLSpawAggregate performs analysis with an aggregated spatially weighted contextual indicator. Both functions provide only conventional statistical estimates and accept only one contextual predictor.

Value

A list of MLSpawExactOutput-class objects

Author(s)

Till Junge, Sandra Penic, Guy Elcheroth

References

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.

Examples

 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
#### ExploreMLSpaw
# Exploratory spatially weighted multilevel with standard estimates of
# standard errors. Accepts only one contextual predictor. Predicting
# collective guilt acceptance. Precise contextual predictor (ethnic homogeneity)
# weighted with geographical proximity weights, h=50,100,200.

# load individual level data, remove collective guilt assignment from the
# data frame, and remove NA's
data(traces_ind)

traces_ind <- traces_ind[,-7]
traces_ind <- na.exclude(traces_ind)

# load precise contextual indicator
data(homog_census)

# load distance matrix
data(d_geo)

# perform ExploreMLSpawExact
acc_homog <- ExploreMLSpawExact(
  individual.level.data=traces_ind,
  contextual.name="Homog_00",
  context.id="area.name",
  formula=cg_acc ~ victim_d + comb_d + male + age_1990 + high_school +
  higher_edu + (1|area.name),
  precise.data=homog_census,
  distance.matrix=d_geo,
  multilevel.bandwidths=c(50, 100))

spacom documentation built on May 1, 2019, 7:35 p.m.