The package is designed to analyze causal relationships in spatially and temporally referenced data. Specific types of events might affect subsequent levels of other events. To estimate the corresponding effect, treatment, control, and dependent events are selected from the empirical sample. Treatment effects are established through automated matching and a diff-in-diffs regression design. The analysis is repeated for various spatial and temporal offsets from the treatment events.
The full functionality of mwa is given through
matchedwake, which relies on a small set of auxiliary methods. Note that
plot() commands are overloaded to return outputs specific to class
matchedwake. For performance reasons, the iterative counting is done in Java using the rJava interface.
IMPORTANT: The size of the Java heap space has to be set before first calling the package via
library(mwa) since JVM size cannot change once it has been initialized. This also implies that R has to be restarted if another library was already using a JVM in order for the heap space option to have any effect. To set the heap space to 1 GB, for example, use
options(java.parameters = "-Xmx1g") (512 MB is the default size).
Sebastian Schutte and Karsten Donnay
Schutte, S., Donnay, K. (2014). “Matched wake analysis: Finding causal relationships in spatiotemporal event data.” Political Geography 41:1-10.
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
# Loading sample data data(mwa_data) # Specify required parameters: # - 2 to 10 days in steps of 2 t_window <- c(2,10,2) # - 2 to 10 kilometers in steps of 2 spat_window <- c(2,10,2) # - column and entries that indicate treatment events treatment <- c("type","treatment") # - column and entries that indicate control events control <- c("type","control") # - column and entries that indicate dependent events dependent <- c("type","dependent") # - columns to match on matchColumns <- c("match1","match2") # Specify optional parameters: # - use weighted regression (default estimation method is "lm") weighted <- TRUE # - temporal units t_unit <- "days" # - match on counts of previous treatment and control events TCM <- TRUE # Execute method: results <- matchedwake(mwa_data, t_window, spat_window, treatment, control, dependent, matchColumns, weighted = weighted, t_unit = t_unit, TCM = TCM) # Plot results: plot(results) # Return detailed summary of results: summary(results, detailed = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.