# NOT RUN {
model <- make_model("X -> Y") %>% set_prior_distribution(n_draws = 10000)
# }
# NOT RUN {
estimands_df <-query_model(
model,
query = list(ATE = "Y[X=1] - Y[X=0]", Share_positive = "Y[X=1] > Y[X=0]"),
using = c("parameters", "priors"),
expand_grid = TRUE)
estimands_df <-query_model(
model,
query = list(ATE = "Y[X=1] - Y[X=0]", Share_positive = "Y[X=1] > Y[X=0]"),
using = c("parameters", "priors"),
expand_grid = FALSE)
estimands_df <- query_model(
model,
using = list( "parameters", "priors"),
query = list(ATE = "Y[X=1] - Y[X=0]", Is_B = "Y[X=1] > Y[X=0]"),
given = list(TRUE, "Y==0 & X==1"),
expand_grid = TRUE,
digits = 3)
# An example: a stat representing uncertainty of token causation
token_var <- function(x) mean(x)*(1-mean(x))
estimands_df <- query_model(
model,
using = list( "parameters", "priors"),
query = "Y[X=1] > Y[X=0]",
stats = c(mean = mean, sd = sd, token_var = token_var))
# }
Run the code above in your browser using DataLab