# coin: Coincidence matrix. In netCoin: Interactive Analytic Networks

 coin R Documentation

## Coincidence matrix.

### Description

A coincidence object consists of a list with two elements: 1) the number of scenarios (\$n), and 2) a coincidence matrix of events, whose main diagonal figures are the frequency of events and outside this diagonal there are conjoint frequencies of these events (\$f)

### Usage

``````coin(incidences, minimum = 1, maximum = nrow(incidences),
sort = FALSE, decreasing = TRUE,
total = FALSE, subsample = FALSE,
weight = NULL, pairwise = FALSE)
``````

### Arguments

 `incidences` an incidence matrix or data frame with only 0/1 variables `minimum` minimum frequency to be considered `maximum` maximum frequency to be considered `sort` sort the coincidence matrix according to frequency of events `decreasing` decreasing or increasing sort of the matrix `total` add one first row and column with total `subsample` retrict the analysis to scenarios with at least one event `weight` a vector of weights. Optimal for data.framed tables `pairwise` Pairwise mode of handling missing values if TRUE. Listwise by default.

### Details

Produce a matrix of coincidences from a matrix of incidences.

### Value

An object of `coin` class

 `n` Number of scenarios (rows of the incidence matrix) `f` Coincidence matrix

### Author(s)

Modesto Escobar, Department of Sociology and Communication, University of Salamanca. See https://sociocav.usal.es/blog/modesto-escobar/

### References

Escobar, M. and Martinez-Uribe, L. (2020) Network Coincidence Analysis: The `netCoin` `R` Package. Journal of Statistical Software, 93, 1-32. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.18637/jss.v093.i11")}.

### Examples

``````## Random incidence matrix: 25 scenarios, 4 events.
I <- matrix(rbinom(100, 1, .5), nrow = 25, ncol = 4,
dimnames = list(NULL, c("A", "B", "C", "D")))
coin(I, sort = TRUE)

## Hair by Eye by Sex table from M. Friendly (2000)
data(HairEyeColor)
H<-as.data.frame(HairEyeColor)
W<-H\$Freq