Skip to contents

Check parameters sum to 1 in param_set; normalize if needed; add names if needed

Usage

clean_params(parameters_df, warning = TRUE)

Arguments

parameters_df

A data.frame. This object is first generated by make_model.

warning

Logical. Whether to print warning (if any) in console. Defaults to TRUE

Value

A parameters data.frame with names and where parameters sum to 1.

Examples

# \donttest{
model <- make_model('X->Y')
model$parameters_df$param_value <- 1:6
CausalQueries:::clean_params(model$parameters_df, warning = TRUE)
#> Parameters in set X do not sum to 1. Using normalized parameters
#> Parameters in set Y do not sum to 1. Using normalized parameters
#> Mapping of model parameters to nodal types: 
#> 
#> ----------------------------------------------------------------
#> 
#>  param_names: name of parameter
#>  node: name of endogeneous node associated with the parameter
#>  gen: partial causal ordering of the parameter's node
#>  param_set: parameter groupings forming a simplex
#>  given: if model has confounding gives conditioning nodal type
#>  param_value: parameter values
#>  priors: hyperparameters of the prior Dirichlet distribution 
#> 
#> ----------------------------------------------------------------
#> 
#>   param_names node gen param_set nodal_type given param_value priors
#> 1         X.0    X   1         X          0         0.3333333      1
#> 2         X.1    X   1         X          1         0.6666667      1
#> 3        Y.00    Y   2         Y         00         0.1666667      1
#> 4        Y.10    Y   2         Y         10         0.2222222      1
#> 5        Y.01    Y   2         Y         01         0.2777778      1
#> 6        Y.11    Y   2         Y         11         0.3333333      1
# }