if (FALSE) { # (rlang::is_installed("btergm") & rlang::is_installed("network"))
library(btergm)
library(network)
set.seed(5)
# create 10 random networks with 10 actors
networks <- list()
for (i in 1:10) {
mat <- matrix(rbinom(100, 1, .25), nrow = 10, ncol = 10)
diag(mat) <- 0
nw <- network(mat)
networks[[i]] <- nw
}
# create 10 matrices as covariates
covariates <- list()
for (i in 1:10) {
mat <- matrix(rnorm(100), nrow = 10, ncol = 10)
covariates[[i]] <- mat
}
# fit the model
mod <- btergm(networks ~ edges + istar(2) + edgecov(covariates), R = 100)
# summarize model fit with tidiers
tidy(mod)
}
Run the code above in your browser using DataLab