missSBM (version 0.2.0)

sampledNetwork: An R6 Class to represent sampled network data

Description

The function sample and prepare_data produces an instance of an object with class sampledNetwork.

Usage

sampledNetwork

Arguments

Format

An object of class R6ClassGenerator of length 24.

Fields

samplingRate

percentage of observed dyads

nNodes

number of nodes

nDyads

number of dyads

is_directed

direction

adjacencyMatrix

adjacency matrix (with NA)

covarMatrix

the matrix of covariates (if applicable)

covarArray

the array of covariates (if applicable)

dyads

list of potential dyads in the network

missingDyads

array indices of missing dyads

observedDyads

array indices of observed dyads

samplingMatrix

matrix of observed and non-observed edges

observedNodes

vector of observed and non-observed nodes

NAs

boolean for NA entries in the adjacencyMatrix

Details

All fields of this class are only accessible for reading. This class comes with a basic plot and print methods

Examples

Run this code
# NOT RUN {
## SBM parameters
directed <- FALSE
N <- 300 # number of nodes
Q <- 3   # number of clusters
alpha <- rep(1,Q)/Q     # mixture parameter
pi <- diag(.45,Q) + .05 # connectivity matrix

## simulate a SBM without covariates
sbm <- missSBM::simulate(N, alpha, pi, directed)

## Sample network data
sampled_network <-
     missSBM::sample(
       adjacencyMatrix = sbm$adjacencyMatrix,
       sampling        = "double-standard",
       parameters      = c(0.4, 0.8)
     )

print(sampled_network)
plot(sampled_network, clustering = sbm$memberships)
# }

Run the code above in your browser using DataLab