Skip to contents

Draw conclusions from a model given a query, data, and process tracing strategies

Usage

process_tracing_estimator(causal_model, query, data, strategies)

Arguments

causal_model

a model generated by CausalQueries

query

a causal query of interest

data

a single row dataset with data on nodes in the model

strategies

a vector describing sets of nodes to be examined e.g. c("X", "X-Y")

Value

a data.frame of estimates

Details

See https://book.declaredesign.org/observational-causal.html#process-tracing

Examples

# Simple example showing ambiguity in attribution
process_tracing_estimator(
  causal_model = CausalQueries::make_model("X -> Y"),
  query = "Y[X=1] > Y[X=0]",
  data = data.frame(X=1, Y = 1),
  strategies = "X-Y")
#> Loading required namespace: CausalQueries
#> 
#> Causal queries generated by query_model
#> 
#> |term |XY   | estimate|
#> |:----|:----|--------:|
#> |X-Y  |X1Y1 |      0.5|
#> 

# Example where M=1 acts as a hoop test
process_tracing_estimator(
  causal_model = CausalQueries::make_model("X -> M -> Y") |>
   CausalQueries::set_restrictions("Y[M=1] < Y[M=0]") |>
   CausalQueries::set_restrictions("M[X=1] < M[X=0]"),
  query = "Y[X=1] > Y[X=0]",
  data = data.frame(X=1, Y = 1, M = 0),
  strategies = c("Y", "X-Y", "X-M-Y"))
#> 
#> Causal queries generated by query_model
#> 
#> |term  |XY   | estimate|
#> |:-----|:----|--------:|
#> |Y     |X1Y1 |    0.111|
#> |X-Y   |X1Y1 |    0.200|
#> |X-M-Y |X1Y1 |    0.000|
#>