construct: Constructing a DAG.

Description Usage Arguments Value Author(s) See Also Examples

View source: R/DAGstructure.R

Description

Constructs a DAG from a given collection of sets. Filters duplicates, and checks whether the eventual DAG structure has twoway logical relationships.

Usage

1
construct (sets)

Arguments

sets

A list of sets/hypotheses for which you want to construct a DAG according to the underlying subset relations.

Value

The function construct returns an object of class DAGstructure.

Author(s)

Rosa Meijer: r.j.meijer@lumc.nl

See Also

DAGstructure

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
  
  #Generate data, where the response Y is associated with two (out of 4) covariates
  set.seed(1)
  n=100
  p=4
  X <- matrix(rnorm(n*p),n,p)
  beta <- c(0,0.5,0.5,0)
  Y <- X %*% beta + rnorm(n)
  
  # Let us assume we have the following sets that we want to test: 
  sets <- list(c(1,2,3,4), c(1,2), c(2,3,4), c(2,3), 1, 2, 3, 4)
  names(sets) <- c(1234, 12, 234, 23, 1, 2, 3, 4)
  
  # Start by making the corresponding graph structure
  struct <- construct(sets)
  
  # Check whether the DAG has toway logical relations: 
  istwoway(struct)

cherry documentation built on May 7, 2021, 5:06 p.m.