check_direction: check_direction

Description Usage Arguments Examples

Description

Function to check the direction of the variables in dir_list. Assumptions: the variables in the abs_groups are directed equally, and there is at least 1 directed edge in abs_group1. (this has been checked before the function is called)

Usage

1
check_direction(pdag, dir_list, abs_group1)

Arguments

pdag
dir_list
abs_group1

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (pdag, dir_list, abs_group1)
{
    a <- dir_list[[1]]
    b <- dir_list[[2]]
    if (pdag[a, b] == 1 & pdag[b, a] == 0) {
        cat("the edge is directed as ", a, "->", b)
        if (a %in% abs_group1) {
            return(group1 <- TRUE)
        }
        else {
            return(group1 <- FALSE)
        }
    }
    if (pdag[b, a] == 1 & pdag[a, b] == 0) {
        cat("the edge is directed as ", a, "<-", b)
    }
    if (b %in% abs_group1) {
        return(group1 <- FALSE)
    }
    else {
        return(group1 <- TRUE)
    }
  }

gekepals/pcabs documentation built on June 15, 2019, 12:03 a.m.