Given a graphical model (e.g., a DAG) and a dataframe, this function derives the testable implications and it tests them against the given dataframe. It is a wrapper around the localTests function to take into account the following points:

  • A single DAG can result in multiple adjustment sets, and we might want to test all of them.

  • The DAG might have been built using nodes with names that differ from the variables in the dataframe, so we need to map them.

  • We might have multiple exposure variables in the dataframe, and only one exposure node in the DAG. So we might want to test all of them.

test_npsem(dag, dat, meta, params)

Arguments

dag

A dagitty object.

dat

A dataframe containing the variables of interest. A dataframe.

meta

A dataframe containing the metadata. A dataframe.

params

A named list with the following variables:

  • type_mas, the type of adjustment set.

  • type_effect, the type of effect to be estimated.

  • identifier, the name of the variable in dat to be used as subject identifier.

Value

A named list containing the results of the call to the localTests function for each adjustment set and each exposure. A list.