The CAUSALGRAPH Procedure

TESTID Statement

  • TESTID <'label'> variable-list </ options>;

The TESTID statement tests whether a criterion that you specify is valid for identifying a causal effect. The form of the variable-list depends on which method you specify in the METHOD= option in the PROC CAUSALGRAPH statement and is described later in this section. The causal effect to be identified is specified by the IDENTIFY statement. You must specify the IDENTIFY statement in order to use a TESTID statement.

For example, the following code tests two specified adjustment sets to determine whether each set is sufficient for the unbiased estimation of the causal effect of X on Y:

proc causalgraph method=adjustment;
   model 'TESTID Demo'
      Z ==> X ==> Y,
      U => X Y,
      W => Z U;
   identify X => Y;
   testid U;
   testid U W;
run;

The following example tests whether you can use the variable Z as an instrument for the causal effect of X on Y when U is unmeasured:

proc causalgraph method=iv;
   model 'TESTID Demo'
      Z ==> X ==> Y,
      U => X Y,
      W => Z U;
   identify X => Y;
   testid Z;
   unmeasured U;
run;

For more information about when an estimation criterion is valid, see the section Causal Effect Identification.

When METHOD=ADJUSTMENT, ANCESTOR, BACKDOOR, POUTCOME, or PTREATMENT, or when you omit the METHOD= option, variable-list is a list of adjustment variables. This list of variables is tested to see whether it forms a valid adjustment set according to the criterion that you specify in the METHOD= option. For these adjustment methods, the list of variables can be empty. If you specify a set of prescribed adjustment variables in the IDENTIFY statement, then these prescribed adjustment variables are added to the list of variables that you specify in each TESTID statement. If variable-list is empty and there are no prescribed adjustment variables in the IDENTIFY statement, then the TESTID statement tests whether the causal effect is identified without any adjustment.

When METHOD=IV, variable-list consists of a single variable name. This variable name is required and cannot be empty. The single variable is tested to see whether it is an instrumental variable that can be used to estimate the causal effect that you specify in the IDENTIFY statement. If you specify a set of prescribed adjustment variables in the IDENTIFY statement, these variables are ignored.

Regardless of the value of the METHOD= option, every variable in a TESTID statement must be observed. This means that any variable name in variables cannot also be specified in the UNMEASURED statement.

You can specify multiple TESTID statements in each run of the CAUSALGRAPH procedure. Each proposed criterion that you specify in a TESTID statement is tested using each model that you specify in a MODEL statement unless you specify the NOANALYSIS option in the MODEL statement.

The label is optional and can be any string of characters enclosed in quotation marks. If you specify a label, it must be the first item in the TESTID statement. If you do not specify a label, then a test name is automatically generated. The autogenerated name has the form "Testi", where i is the smallest positive integer such that each test name is unique. It is recommended that you use your own labels so that you can identify the tests easily in the output results.

You can specify the following options in the TESTID statement:

CONDITIONAL={variables}
CONDITIONAL=[variables]
CONDITIONAL=(variables)
CONDITIONAL=variable

performs a test for a conditional instrumental variable, where the variables or variable is a list of conditioning variables. You can specify this option only if you specify METHOD=IV in the PROC CAUSALGRAPH statement. If you use this option, the procedure determines whether the instrumental variable that you specify in the TESTID statement is a conditional instrument associated with the specified conditioning set of variables.

PATHS <=(path-types)>
PATHS <=path-type>

creates an enumeration of the proper paths from the treatment variables to the outcome variables in each model. You cannot use this option if you specify METHOD=IV in the PROC CAUSALGRAPH statement.

A proper path is a path that begins with a treatment variable and does not contain any other treatment variables. The procedure determines whether each path is causal or noncausal. It also applies the adjustment set that is indicated by the TESTID statement and then determines whether each path is blocked or unblocked.

You can use the path-types argument to change the paths that are displayed. You can specify the following path-type values:

ALL

displays all paths.

BLOCKED

displays blocked paths.

CAUSAL

displays causal paths.

NONBLOCKED

displays nonblocked paths.

NONCAUSAL

displays noncausal paths.

If you do not specify path-types, then PATHS=(ALL) is used by default. You can specify multiple values for path-types at the same time. For example, you can specify PATHS=(CAUSAL BLOCKED) to display all paths that are both causal and blocked.

Last updated: December 09, 2022