Learn R Programming

EconGeo (version 2.0)

co_occurrence: Compute the number of co-occurrences between industry pairs from an incidence (industry - event) matrix

Description

This function computes the number of co-occurrences between industry pairs from an incidence (industry - event) matrix

Usage

co_occurrence(mat, diagonal = FALSE, list = FALSE)

Value

The co-occurrence matrix as an R matrix object.

Arguments

mat

An incidence matrix with industries in rows and events in columns

diagonal

Logical; shall the values in the diagonal of the co-occurrence matrix be included in the output? Defaults to FALSE (values in the diagonal are set to 0), but can be set to TRUE (values in the diagonal reflects in how many events a single industry can be found)

list

Logical; is the input a list? Defaults to FALSE (input = adjacency matrix), but can be set to TRUE if the input is an edge list

Author

Pierre-Alexandre Balland p.balland@uu.nl

References

Boschma, R., Balland, P.A. and Kogler, D. (2015) Relatedness and Technological Change in Cities: The rise and fall of technological knowledge in U.S. metropolitan areas from 1981 to 2010, Industrial and Corporate Change 24 (1): 223-250

See Also

relatedness, relatedness_density

Examples

Run this code
## generate a region - events matrix
set.seed(31)
mat <- matrix(sample(0:1, 20, replace = TRUE), ncol = 5)
rownames(mat) <- c("I1", "I2", "I3", "I4")
colnames(mat) <- c("US1", "US2", "US3", "US4", "US5")

## run the function
co_occurrence(mat)
co_occurrence(mat, diagonal = TRUE)

## generate a regular data frame (list)
my_list <- get_list(mat)

## run the function
co_occurrence(my_list, list = TRUE)
co_occurrence(my_list, list = TRUE, diagonal = TRUE)

Run the code above in your browser using DataLab