Skip to contents

Explore whether relationships between fully observed variables in the specified dataset are consistent with the proposed directed acyclic graph (DAG) using localTests functionality.

Usage

exploreDAG(mdag, data)

Arguments

mdag

The DAG, specified as a string using dagitty syntax

data

A data frame containing all the variables stated in the DAG. All ordinal variables must be integer-coded and all categorical variables must be dummy-coded.

Value

A message indicating whether the relationships between fully observed variables in the specified dataset are consistent with the proposed DAG

Examples

exploreDAG(mdag="matage -> bmi7 mated -> matage mated -> bmi7
                 sep_unmeas -> mated sep_unmeas -> r",
           data=bmi)
#> The proposed directed acyclic graph (DAG) implies the following
#> conditional independencies (where, for example, 'X _||_ Y | Z' should
#> be read as 'X is independent of Y conditional on Z'). Note that
#> variable names are abbreviated:
#> 
#> bmi7 _||_ r | sp_n
#> 
#> bmi7 _||_ r | matd
#> 
#> bmi7 _||_ sp_n | matd
#> 
#> matg _||_ r | sp_n
#> 
#> matg _||_ r | matd
#> 
#> matg _||_ sp_n | matd
#> 
#> matd _||_ r | sp_n
#> 
#> These (conditional) independence statements are explored below using
#> the canonical correlations approach for mixed data. See
#> ??dagitty::localTests for further details.  Results are shown for
#> variables that are fully observed in the specified dataset. The null
#> hypothesis is that the stated variables are (conditionally)
#> independent.
#> 
#>                         estimate  p.value        2.5%      97.5%
#> 
#> matage _||_ r | mated 0.02998323 0.343547 -0.03206946 0.09180567
#> 
#> Interpretation: A small p-value means the stated variables may not be
#> (conditionally) independent in the specified dataset: your data may not
#> be consistent with the proposed DAG. A large p-value means there is
#> little evidence of inconsistency between your data and the proposed
#> DAG.
#> 
#> Note that these results assume that relationships between variables are
#> linear. Consider exploring the specification of each relationship in
#> your model.  Also consider whether it is valid and possible to explore
#> relationships between partially observed variables using the observed
#> data, e.g. avoiding perfect prediction.