get_triad_var: Get Triad Variables

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/get_triad_var.R

Description

Transforms vertex variables or observed directed/undirected ties into triad variables.

Usage

1

Arguments

var

variable vector (actor attribute) or adjacency matrix (ties) to be transformed to a triad variable.

type

either 'att' for actor attribute (default) or 'tie' for relations.

Details

For actor attributes, unique triples of original attribute values constitute the outcome space. Note that the actor attributes need to be categorical with finite range spaces. For example, binary attributes have 8 possible triadic outcomes (0,0,0),(1,0,0),(0,1,0),(1,1,0),(0,0,1),(1,0,1),(0,1,1),(1,1,1) which are coded 0-7. Warning message is shown if actor attribute has too many unique outcomes as it will yield too many possible outcomes once converted in to a triad variable.

For directed relations, a sequence of indicators of length 6 created from the adjacency matrix constitutes the 64 outcomes representing possible combinations of sending and receiving ties.

For undirected relations, triples of indicators are created from the adjacency matrix.

Value

Dataframe with four columns: first three columns show the vertex triad u, v, w , and the fourth column gives the value of the transformed triadic variable var.

Author(s)

Termeh Shafie

References

Frank, O., & Shafie, T. (2016). Multivariate entropy analysis of network data. Bulletin of Sociological Methodology/Bulletin de Méthodologie Sociologique, 129(1), 45-63.

Nowicki, K., Shafie, T., & Frank, O. (Forthcoming 2022). Statistical Entropy Analysis of Network Data.

See Also

get_dyad_var

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
29
30
# use internal data set
data(lawdata)
adj.advice <- lawdata[[1]]
adj.cowork <-lawdata[[3]]
df.att <- lawdata[[4]]

# three steps of data editing:
# 1. categorize variables 'years' and 'age' based on
# approximately three equally size groups (values based on cdf)
# 2. make sure all outcomes start from the value 0 (optional)
# 3. remove variable 'senior' as it consists of only unique values (thus redundant)
df.att.ed <- data.frame(
   status   = df.att$status,
   gender   = df.att$gender,
   office   = df.att$office-1,
   years    = ifelse(df.att$years<=3,0,
              ifelse(df.att$years<=13,1,2)),
   age      = ifelse(df.att$age<=35,0,
                ifelse(df.att$age<=45,1,2)),
   practice = df.att$practice,
   lawschool= df.att$lawschool-1)

# actor attribute converted to triad variable
triad.gend <- get_triad_var(df.att.ed$gender, 'att')

# directed tie converted to triad variable
triad.adv <- get_triad_var(adj.advice, type = 'tie')

# undirected tie converted to triad variable
triad.cwk <- get_triad_var(adj.cowork, type = 'tie')

netropy documentation built on Feb. 2, 2022, 9:07 a.m.