# NOT RUN {
model <- make_model('X -> M -> Y; X -> Y')
CausalQueries:::make_par_values(model, distribution = 'jeffreys')
CausalQueries:::make_par_values(model, x = 3)
# Selecting subsets:
# By node
CausalQueries:::make_par_values(model, node = 'M', x = 8)
# By nodal type statement
CausalQueries:::make_par_values(model,
statement = '(Y[X=1, M = .] > Y[X=0, M = .])', x = 2)
# By nodal type label (safest to provide node also)
CausalQueries:::make_par_values(model, node = 'X', label = '0', x = 9)
# By confound query: Applies only to types that are involved in confounding
# Only alters named node in confound, even if other nodes are listed in 'nodes'
confounds <- list(X = 'Y[X=1] > Y[X=0]', X = 'Y[X=1] < Y[X=0]')
model <- make_model('X->Y') %>% set_confound(confounds)
CausalQueries:::make_par_values(model, confound = confounds[1], x = 3)
CausalQueries:::make_par_values(model, node = 'Y', confound = confounds[1], x = 3)
# A residual confound condition can also be defined
CausalQueries:::make_par_values(model,
confound = list(X = '!(Y[X=1] > Y[X=0])'),
x = 3)
CausalQueries:::make_par_values(model,
confound = list(X = '(Y[X=1] == Y[X=0])'),
x = 3)
# make_par_values can also be used for some vector valued statements
model <- make_model('X -> M -> Y')
CausalQueries:::make_par_values(model, node = c('X', 'Y'), x = 2)
CausalQueries:::make_par_values(model, label = c('1', '01'), x = 2)
# Incompatible conditions produce no change
CausalQueries:::make_par_values(model, node = 'X', label = '01', x = 2)
# If statement not satisfied by any cases then no change
model <- make_model("X->Y")
CausalQueries:::make_par_values(model, statement = '(Y[X=1] == 2)', x = .1)
# Normalization: Take in a parameter vector and output is renormalized
model <- make_model("X->Y")
CausalQueries:::make_par_values(model,
y = get_parameters(model),
label = '01',
x = .1,
normalize = TRUE)
CausalQueries:::make_par_values(model,
y = get_parameters(model),
statement = '(Y[X=1] == Y[X=0])',
x = .1,
normalize = TRUE)
# Problematic examples
# }
# NOT RUN {
CausalQueries:::make_par_values(model, x = 1:2)
CausalQueries:::make_par_values(model,
y = get_parameters(model),
label = '01',
x = 2,
normalize = TRUE)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab