Answers a causal query about one case using a causal model from 'CausalQueries', once for each process tracing strategy. A strategy names the nodes whose values are observed, so the estimate shows how the answer changes as more of the case's data is examined.
Arguments
- causal_model
A model from
CausalQueries::make_model().- query
The causal query, in 'CausalQueries' syntax, e.g.
"Y[X=1] > Y[X=0]".- data
A one-row data frame giving the case's value on each observed node. Nodes that are
NAare treated as unobserved.- strategies
A character vector of strategies, each listing the nodes observed, separated by hyphens, e.g.
c("X-Y", "X-M-Y").
Value
A data frame with one row per strategy: term (the strategy), XY (the case's values of X and Y, e.g. "X1Y1"), and estimate (the posterior mean of the query).
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")
#>
#> 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|
#>
