Description Usage Arguments Examples
View source: R/expected_learning.R
Expected reduction in variance from one step data collection strategy
1 2 | expected_learning(model, query, strategy = NULL, given = NULL,
parameters = NULL)
|
model |
A model |
query |
A query as a character string, for example 'Y[X=1]>Y[X=0]' |
strategy |
A set of variables to be sought |
given |
A conditioning set as a character string that evaluates to a logical, for example 'Y==1' |
parameters |
a parameter vector |
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 36 | # Reduction in variance given monotonic X -> M1 -> M2 -> Y model
library(dplyr)
model <- make_model("X -> M1 -> M2 -> Y") %>%
set_restrictions(node_restrict = list(M1 = "10", M2 = "10", Y = "10")) %>%
set_priors() %>%
set_parameters(type = 'flat')
el <- expected_learning(model, query = "Y[X=1]>Y[X=0]",
strategy = c("X", "M2"), given = "Y==1")
attr(el, "results_table")
el2 <- expected_learning(model, query = "Y[X=1]>Y[X=0]",
strategy = c("M1"),
given = "Y==1 & X==1 & M2==1")
attr(el2, "results_table")
# No strategy
expected_learning(model, query = "Y[X=1]>Y[X=0]")
# No givens
expected_learning(model, query = "Y[X=1]>Y[X=0]",
strategy = c("M1"))
expected_learning(model, query = "Y[X=1]>Y[X=0]",
strategy = c("M1"), given = "Y==1")
library(dplyr)
model <- make_model("S -> C -> Y <- R <- X; X -> C -> R") %>%
set_restrictions(node_restrict =
list(C = "C1110", R = "R0001", Y = "Y0001"),
keep = TRUE)
expected_learning(model,
query = list(COE = "(Y[S=0] > Y[S=1])"),
strategy = "C", given = "Y==1 & S==0")
expected_learning(model,
query = list(COE = "(Y[X=1] > Y[X=0])"),
strategy = "S", given = "X==0 & Y==0")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.