Description Usage Arguments Examples
View source: R/conditional_inferences.R
Calculate estimands conditional on observed data (currently, for single-case process tracing) together with data realization probabilities Realization probabilities are the probability of the observed data given data is sought on observed variables
1 | conditional_inferences(model, query, parameters = NULL, given = NULL)
|
model |
A model generated by |
query |
A character vector of length 1L. Query for example 'Y[X=1]>Y[X=0]' |
parameters |
A numeric vector. Values of parameters may be specified. By default, it is drawn from priors. |
given |
A conditioning set as a character string that evaluates to a logical, for example 'Y==1' |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | model <- make_model("X->Y")
model <- set_parameters(model, type = "flat")
conditional_inferences(model, query = "Y[X=1]>Y[X=0]")
# Example of posteriors given monotonic X -> M -> Y model
library(dplyr)
model <- make_model("X-> M -> Y") %>%
set_restrictions(node_restrict = list(M = "10", Y = "10")) %>%
set_parameters(type = "flat")
conditional_inferences(model, query = "Y[X=1]>Y[X=0]", given = "Y==1")
# Running example
model <- make_model("S -> C -> Y <- R <- X; X -> C -> R") %>%
set_restrictions(node_restrict =
list(C = "C1110", R = "R0001", Y = "Y0001"), keep = TRUE)
conditional_inferences(model, query = list(COE = "(Y[S=0] > Y[S=1])"),
given = "Y==1 & S==0")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.