chooseBlockRow {nemBM}R Documentation

Sum of squared error across blocks

Description

The actor choose the block (i.e., column in an image matrix) in which he will change a link, based on the difference between the density of his out-degrees by blocks and the ideal block density.

Usage

chooseBlockRow(X, actor, partition, M, loops, randomBlock = FALSE)

Arguments

X

Binary network; of class matrix.

actor

A unit (actor; row/column number), which have an opportunity to change a link.

partition

A partition in a vector format. Each unique value (positive integers) represents one cluster.

M

Image matrix with block densities.

loops

Wheter loops are allowed or not.

randomBlock

How to select a block; the one with the highest difference (FALSE, default), proportionally to the differences (linear) or squared differences (square).

Value

A vector with two elements: block (selected block number) and sign (wheter the selected block is too sparse (-1) or too dense (+1)).

Author(s)

Marjan Cugmas

Examples

X <- matrix(sample(c(0,1), size = 9**2, replace = TRUE), nrow = 9)
diag(X) <- 0
M <- matrix(c(0.1, 0.4, 0.5, 0.3), nrow = 2)
partition <- c(1, 2, 2, 1, 1, 2, 2, 2, 1)
chooseBlockRow(X = X, actor = 3, partition = partition, 
M = M, loops = FALSE, randomBlock = "square")

[Package nemBM version 1.00.01 Index]