stochBlockKMint {StochBlock}R Documentation

A function for using k-means to initialized the stochastic one-mode and linked blockmodeling.

Description

A function for using k-means to initialized the stochastic one-mode and linked blockmodeling.

Usage

stochBlockKMint(
  M,
  k,
  nstart = 100,
  perm = 0,
  sharePerm = 0.2,
  save.initial.param = TRUE,
  deleteMs = TRUE,
  max.iden = 10,
  return.all = FALSE,
  return.err = TRUE,
  seed = NULL,
  maxTriesToFindNewPar = perm * 10,
  skip.par = NULL,
  printRep = ifelse(perm <= 10, 1, round(perm/10)),
  n = NULL,
  nCores = 1,
  useParLapply = FALSE,
  cl = NULL,
  stopcl = is.null(cl),
  ...
)

Arguments

M

A square matrix giving the adjaciency relationg between the network's nodes (aka vertexes)

k

The number of clusters used in the generation of partitions.

nstart

number of random starting points for the classical k-means algorithm (for each set of units). Defaults to 100.

perm

Number or partitions obtained by randomly permuting the k-means partition - if 0, no permutations are made, only the original partition is analyzed.

sharePerm

The probability that a unit will have their randomly assigned. Defaults to 0.20.

save.initial.param

Should the inital parameters(approaches, ...) of using stochBlock be saved. The default value is TRUE.

deleteMs

Delete networks/matrices from the results of to save space. Defaults to TRUE.

max.iden

Maximum number of results that should be saved (in case there are more than max.iden results with minimal error, only the first max.iden will be saved).

return.all

If FALSE, solution for only the best (one or more) partition/s is/are returned.

return.err

Should the error for each optimized partition be returned. Defaults to TRUE.

seed

Optional. The seed for random generation of partitions.

maxTriesToFindNewPar

The maximum number of partition try when trying to find a new partition to optimize that was not yet checked before - the default value is rep * 1000.

skip.par

The partitions that are not allowed or were already checked and should therefore be skipped.

printRep

Should some information about each optimization be printed.

n

The number of units by "modes". It is used only for generating random partitions. It has to be set only if there are more than two modes or if there are two modes, but the matrix representing the network is one mode (both modes are in rows and columns).

nCores

Number of cores to be used. Value 0 means all available cores. It can also be a cluster object.

useParLapply

Should parLapplyLB be used (otherwise foreach is used). Defaults to true as it needs less dependencies. It might be removed in future releases and only allow the use of parLapplyLB.

cl

The cluster to use (if formed beforehand). Defaults to NULL.

stopcl

Should the cluster be stopped after the function finishes. Defaults to is.null(cl).

...

Arguments passed to other functions, see stochBlock.

Value

A list containing:

M

The one- or multi-mode matrix of the network analyzed

res

If return.all = TRUE - A list of results the same as best - one best for each partition optimized.

best

A list of results from stochblock, only without M.

err

If return.err = TRUE - The vector of errors or inconsistencies of the empirical network with the ideal partitions.

nIter

The vector of the iterations on each starting partition. If many of the values equalmaxiter, then maxiter may be too small.

checked.par

If selected - A list of checked partitions. If merge.save.skip.par is TRUE, this list also includes the partitions in skip.par.

call

The call to this function.

initial.param

If selected - The initial parameters are used.

Author(s)

Aleš, Žiberna

References

Škulj, D., & Žiberna, A. (2022). Stochastic blockmodeling of linked networks. Social Networks, 70, 240-252.


[Package StochBlock version 0.1.2 Index]