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)

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

References

Escobar, M. and Martinez-Uribe, L. (2020) Network Coincidence Analysis: The netCoin R Package. Journal of Statistical Software, 93, 1-32. doi: 10.18637/jss.v093.i11 .

Author

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

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)
#> n= 25 #> A B C D #> A 18 #> B 13 15 #> C 10 9 14 #> D 9 5 5 12
## Hair by Eye by Sex table from M. Friendly (2000) data(HairEyeColor) H<-as.data.frame(HairEyeColor) W<-H$Freq I<-dichotomize(H,c("Hair","Eye","Sex"),add=FALSE) coin(I,w=W)
#> n= 592 #> Hair:Black Hair:Blond Hair:Brown Hair:Red Eye:Blue Eye:Brown #> Hair:Black 108 #> Hair:Blond 0 127 #> Hair:Brown 0 0 286 #> Hair:Red 0 0 0 71 #> Eye:Blue 20 94 84 17 215 #> Eye:Brown 68 7 119 26 0 220 #> Eye:Green 5 16 29 14 0 0 #> Eye:Hazel 15 10 54 14 0 0 #> Sex:Female 52 81 143 37 114 122 #> Sex:Male 56 46 143 34 101 98 #> Eye:Green Eye:Hazel Sex:Female Sex:Male #> Hair:Black #> Hair:Blond #> Hair:Brown #> Hair:Red #> Eye:Blue #> Eye:Brown #> Eye:Green 64 #> Eye:Hazel 0 93 #> Sex:Female 31 46 313 #> Sex:Male 33 47 0 279