alphas: Real positive numbers giving hyperparameters of the Dirichlet distribution
distribution: string indicating a common prior distribution (uniform, jeffreys or certainty)
alter_at: string specifying filtering operations to be applied to parameters_df, yielding a logical vector indicating parameters for which values should be altered. (see examples)
node: string indicating nodes which are to be altered
nodal_type: string. Label for nodal type indicating nodal types for which values are to be altered
label: string. Label for nodal type indicating nodal types for which values are to be altered. Equivalent to nodal_type.
param_set: string indicating the name of the set of parameters to be altered
given: string indicates the node on which the parameter to be altered depends
statement: causal query that determines nodal types for which values are to be altered
join_by: string specifying the logical operator joining expanded types when statement contains wildcards. Can take values '&' (logical AND) or '|' (logical OR).
param_names: vector of strings. The name of specific parameter in the form of, for example, 'X.1', 'Y.01'
nodes: a vector of nodes
Returns
A vector indicating the parameters of the prior distribution of the nodal types ("hyperparameters").
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 the priors attached to it.
A vector indicating the hyperparameters of the prior distribution of the nodal types.
Details
Seven arguments govern which parameters should be altered. The default is 'all' but this can be reduced by specifying
alter_at String specifying filtering operations to be applied to parameters_df, yielding a logical vector indicating parameters for which values should be altered. "node == 'X' & nodal_type
node, which restricts for example to parameters associated with node 'X'
label or nodal_type The label of a particular nodal type, written either in the form Y0000 or Y.Y0000
param_set The param_set of a parameter.
given Given parameter set of a parameter.
statement, which restricts for example to nodal types that satisfy the statement 'Y[X=1] > Y[X=0]'
param_set, given, which are useful when setting confound statements that produce several sets of parameters
Two arguments govern what values to apply:
alphas is one or more non-negative numbers and
distribution indicates one of a common class: uniform, Jeffreys, or 'certain'
Forbidden statements include:
Setting distribution and values at the same time.
Setting a distribution other than uniform, Jeffreys, or certainty.
Setting negative values.
specifying alter_at with any of node, nodal_type, param_set, given, statement, or param_names
specifying param_names with any of node, nodal_type, param_set, given, statement, or alter_at
specifying statement with any of node or nodal_type
Examples
# make_priors examples:# Pass all nodal typesmodel <- make_model("Y <- X")make_priors(model, alphas =.4)make_priors(model, distribution ="jeffreys")model <- CausalQueries::make_model("X -> M -> Y; X <-> Y")#altering values using \code{alter_at}make_priors(model = model, alphas = c(0.5,0.25),alter_at ="node == 'Y' & nodal_type %in% c('00','01') & given == 'X.0'")#altering values using \code{param_names}make_priors(model = model, alphas = c(0.5,0.25),param_names = c("Y.10_X.0","Y.10_X.1"))#altering values using \code{statement}make_priors(model = model, alphas = c(0.5,0.25),statement ="Y[M=1] > Y[M=0]")#altering values using a combination of other argumentsmake_priors(model = model, alphas = c(0.5,0.25),node ="Y", nodal_type = c("00","01"), given ="X.0")# set_priors examples:# Pass all nodal typesmodel <- make_model("Y <- X")set_priors(model, alphas =.4)set_priors(model, distribution ="jeffreys")model <- CausalQueries::make_model("X -> M -> Y; X <-> Y")#altering values using \code{alter_at}set_priors(model = model, alphas = c(0.5,0.25),alter_at ="node == 'Y' & nodal_type %in% c('00','01') & given == 'X.0'")#altering values using \code{param_names}set_priors(model = model, alphas = c(0.5,0.25),param_names = c("Y.10_X.0","Y.10_X.1"))#altering values using \code{statement}set_priors(model = model, alphas = c(0.5,0.25),statement ="Y[M=1] > Y[M=0]")#altering values using a combination of other argumentsset_priors(model = model, alphas = c(0.5,0.25), node ="Y",nodal_type = c("00","01"), given ="X.0")