# \donttest{
n <- 12
grp <- sample(letters[1:3], n, replace = TRUE)
age <- rnorm(n, 40, 10)
# build a single same-group homophily covariate
Xdyad <- array(nodematch(grp), dim = c(n, n, 1),
dimnames = list(NULL, NULL, "same_group"))
# combine homophily + age difference
Xdyad <- array(c(nodematch(grp), absdiff(age)),
dim = c(n, n, 2),
dimnames = list(NULL, NULL, c("same_group", "age_diff")))
# }
Run the code above in your browser using DataLab