set_confounds_df {CausalQueries}R Documentation

Set a confounds_df

Description

Normally a confounds_df is added to a model whenever confounding is set. The confounds_df can be manually provided however using set_confounds_df.

Usage

set_confounds_df(model)

Arguments

model

A causal_model. A model object generated by make_model.

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 the confound_df attached to the parameter matrix in the model.

Examples


model <- make_model('X -> Y') %>%
  set_confound(list('X <-> Y'), add_confounds_df = FALSE)
model$confounds_df
set_confounds_df(model)$confounds_df

# An example where a restriction is applied after a confounding relation is set removes
model <- make_model('X -> Y') %>%
  set_confound(list(X = '(Y[X=1] > Y[X=0])')) %>%
  set_restrictions('(Y[X=1] > Y[X=0])')


[Package CausalQueries version 0.0.3 Index]