VariableStatus {dagitty}R Documentation

Variable Statuses

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

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

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


[Package dagitty version 0.3-4 Index]