get_dyad_var: Get Dyad Variables

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

View source: R/get_dyad_var.R

Description

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

Usage

1
get_dyad_var(var, type = "att")

Arguments

var

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

type

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

Details

Dyad variables are given as pairs of incident vertex variables or actor attributes. Here, unique pairs of original attribute values constitute the outcome space. Note that the actor attributes need to be categorical with finite range spaces. For example, binary attribute yields outcome space (0,0), (0,1), (1,0), (1,1) coded as (0),(1),(2),(3). 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 dyad variable.

For directed relations, pairs of indicators from the adjacency matrix constitute the four outcomes representing possible combinations of sending and receiving ties: (0,0), (0,1), (1,0), (1,1) coded as (0),(1),(2),(3).

For undirected relations, an indicator variable which is directly read from the adjacency matrix represents the dyadic variable.

Value

Dataframe with three columns: first two columns show the vertex pairs u and v where u<v , and the third column gives the value of the transformed dyadic 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_triad_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 of attribute dataframe:
# 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 dyad variable
dyad.gend <- get_dyad_var(df.att.ed$gender, 'att')

# directed tie converted to dyad variable
dyad.adv <- get_dyad_var(adj.advice, 'tie')

# undirected tie converted to dyad variable
dyad.cwk <- get_dyad_var(adj.cowork, 'tie')

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