coin: Coincidence matrix.

coinR Documentation

Coincidence matrix.

Description

A coin object is a squared matrix of coincidences with its names and the frequency of events as attributes.

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
I<-dichotomize(H,c("Hair","Eye","Sex"),add=FALSE)
coin(I,w=W)

netCoin documentation built on Oct. 18, 2024, 5:10 p.m.