set_parameters {CausalQueries}R Documentation

Set parameters

Description

Add a true parameter vector to a model. Parameters can be created using arguments passed to make_parameters and make_priors.

Usage

set_parameters(
  model,
  parameters = NULL,
  param_type = NULL,
  warning = FALSE,
  ...
)

Arguments

model

A causal_model. A model object generated by make_model.

parameters

A vector of real numbers in [0,1]. Values of parameters to specify (optional). By default, parameters is drawn from model$parameters_df.

param_type

A character. String specifying type of parameters to set ('flat', 'prior_mean', 'posterior_mean', 'prior_draw', 'posterior_draw', 'define). With param_type set to define use arguments to be passed to make_priors; otherwise flat sets equal probabilities on each nodal param_type in each parameter set; prior_mean, prior_draw, posterior_mean, posterior_draw take parameters as the means or as draws from the prior or posterior.

warning

Logical. Whether to warn about parameter renormalization

...

Arguments to be passed to make_parameters

Details

Argument 'param_type' is passed to make_priors and specifies one of 'flat', 'prior_mean', 'posterior_mean', 'prior_draw', 'posterior_draw', and 'define'. With param_type set to define use arguments to be passed to make_priors; otherwise flat sets equal probabilities on each nodal param_type in each parameter set; prior_mean, prior_draw, posterior_mean, posterior_draw take parameters as the means or as draws from the prior or posterior.

Value

An object of class causal_model. It essentially returns a list containing the elements comprising a model (e.g. 'statement', 'nodal_types' and 'DAG') with true vector of parameters attached to it.

See Also

Other parameters: get_parameters(), make_parameters()

Examples

make_model('X->Y') %>% set_parameters(1:6) %>% get_parameters()

make_model('X -> Y') %>%
  set_confound(list(X = 'Y[X=1]>Y[X=0]'))  %>%
  set_parameters(confound = list(X='Y[X=1]>Y[X=0]', X='Y[X=1]<=Y[X=0]'),
                 parameters = list(c(.2, .8), c(.8, .2))) %>%
  set_parameters(statement = 'Y[X=1]>Y[X=0]', parameters = .5) %>%
  get_parameters

[Package CausalQueries version 0.0.3 Index]