statmat

0th

Percentile

Descriptive Statistics on Flow Matrix

This function provides various indicators and graphical outputs on a flow matrix.

Usage
statmat(mat, output = "all", verbose = TRUE)
Arguments
mat
A square matrix of flows.
output
Graphical output. Choices are "all" for all graphics, "none" to avoid any graphical output, "degree" for degree distribution, "wdegree" for weighted degree distribution, "lorenz" for Lorenz curve of link weights and "boxplot" for boxplot of link weights (see 'Details').
verbose
A boolean, if TRUE, returns statistics in the console.
Details

Graphical ouputs concern outdegrees by default. If the matrix is transposed, outputs concern indegrees.

Value

The function returns a list of statistics and may plot graphics.
  • nblinks: number of cells with values > 0
  • density: number of links divided by number of possible links (also called gamma index by geographers), loops excluded
  • connectcomp: number of connected components (isolates included, weakly connected: use of clusters where mode = "weak")
  • connectcompx: number of connected components (isolates deleted, weakly connected: use of clusters where mode = "weak")
  • sizecomp: a data.frame of connected components: size and sum of flows per component (isolates included)
  • compocomp: a data.frame of connected components giving membership of units (isolates included)
  • degrees: a data.frame of nodes degrees and weighted degrees
  • sumflows: sum of flows
  • min: minimum flow
  • Q1: first quartile of flows
  • median: median flow
  • Q3: third quartile of flows
  • max: maximum flow
  • mean: mean flow
  • sd: standart deviation of flows

See Also

compmat

Aliases
  • statmat
Examples
# Import data
data(nav)
myflows <- prepflows(mat = nav, i = "i", j = "j", fij = "fij")

# Get statistics and graphs about the matrix
mystats <- statmat(mat = myflows, output = "all", verbose = TRUE)

# Size of connected components
mystats$sizecomp

# Sum of flows
mystats$sumflows

# Plot Lorenz curve only
statmat(mat = myflows, output = "lorenz", verbose = FALSE)

# Statistics only
mystats <- statmat(mat = myflows, output = "none", verbose = FALSE)
str(mystats)
Documentation reproduced from package flows, version 1.1.1, License: GPL-3

Community examples

Looks like there are no examples yet.