VariableStatus: Variable Statuses

Description Usage Arguments Details Examples

Description

Get or set variables with a given status in a graph. Variables in dagitty graphs can have one of several statuses. Variables with status exposure and outcome are important when determining causal effects via the functions adjustmentSets and instrumentalVariables. Variables with status latent are assumed to be unobserved variables or latent constructs, which is respected when deriving testable implications of a graph via the functions impliedConditionalIndependencies or vanishingTetrads.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
exposures(x)

exposures(x) <- value

outcomes(x)

outcomes(x) <- value

latents(x)

latents(x) <- value

adjustedNodes(x)

adjustedNodes(x) <- value

setVariableStatus(x, status, value)

Arguments

x

the input graph, of any type.

value

character vector; names of variables to receive the given status.

status

character, one of "exposure", "outcome" or "latent".

Details

setVariableStatus first removes the given status from all variables in the graph that had it, and then sets it on the given variables. For instance, if status="exposure" and value="X" are given, then X will be the only exposure in the resulting graph.

Examples

1
2
3
4
g <- dagitty("dag{ x<->m<->y<-x }") # m-bias graph
exposures(g) <- "x"
outcomes(g) <- "y"
adjustmentSets(g)

dagitty documentation built on Jan. 21, 2021, 5:07 p.m.