missSBM (version 0.2.0)

prepare_data: Prepare network data for estimation with missing data

Description

This function puts together the adjacency matrix of a network and an optional list of covariates into a single sampledNetwork object, ready to use for inference with the estimate function of the missSBM package.

Usage

prepare_data(adjacencyMatrix, covariates = NULL,
  similarity = missSBM:::l1_similarity)

Arguments

adjacencyMatrix

The adjacency matrix of the network (NAs allowed)

covariates

An optional list with M entries (the M covariates). If the covariates are node-centred, each entry of covariates must be a size-N vector; if the covariates are dyad-centred, each entry of covariates must be N x N matrix.

similarity

An optional R x R -> R function to compute similarities between node covariates. Default is l1_similarity, that is, -abs(x-y). Only relevant when the covariates is a list of size-N vectors.

Value

Returns an R6 object with class sampledNetwork.

See Also

estimate and sampledNetwork.

Examples

Run this code
# NOT RUN {
data(war)
adj_beligerent <- war$beligerent %>% igraph::as_adj(sparse = FALSE)
sampledNet_war_nocov <- prepare_data(adj_beligerent)
sampledNet_war_withcov <- prepare_data(adj_beligerent, list(military_power = war$beligerent$power))
# }

Run the code above in your browser using DataLab