incidence.from.distribution function

Generates an incidence matrix with row and column sums that follow given distributions

Generates an incidence matrix with row and column sums that follow given distributions

incidence.from.distribution generates a random incidence matrix with row and column sums that approximately follow beta distributions with given parameters.

incidence.from.distribution( R, C, P, rowdist = c(1, 1), coldist = c(1, 1), class = "matrix", narrative = TRUE )

Arguments

  • R: integer: number of rows
  • C: integer: number of columns
  • P: numeric: probability that a cell contains a 1
  • rowdist: vector length 2: Row marginals will approximately follow a Beta(a,b) distribution
  • coldist: vector length 2: Column marginals will approximately follow a Beta(a,b) distribution
  • class: string: the class of the returned backbone graph, one of c("matrix", "Matrix", "igraph").
  • narrative: boolean: TRUE if suggested text & citations should be displayed.

Returns

An incidence matrix of class matrix or Matrix, or a bipartite graph of class igraph.

Examples

I <- incidence.from.distribution(R = 100, C = 100, P = 0.1, rowdist = c(10000,10000), coldist = c(10000,10000)) #Constant I <- incidence.from.distribution(R = 100, C = 100, P = 0.1, rowdist = c(1,1), coldist = c(1,1)) #Uniform I <- incidence.from.distribution(R = 100, C = 100, P = 0.1, rowdist = c(1,10), coldist = c(1,10)) #Right-tailed I <- incidence.from.distribution(R = 100, C = 100, P = 0.1, rowdist = c(10,1), coldist = c(10,1)) #Left-tailed I <- incidence.from.distribution(R = 100, C = 100, P = 0.1, rowdist = c(10,10), coldist = c(10,10), narrative = TRUE) #Normal

References

Neal, Z. P., Domagalski, R., and Sagan, B. 2021. Comparing alternatives to the fixed degree sequence model for extracting the backbone of bipartite projections. Scientific Reports, 11, 23929. tools:::Rd_expr_doi("10.1038/s41598-021-03238-3")

Neal, Z. P. 2022. incidentally: An R package to generate incidence matrices and bipartite graphs. OSF Preprints tools:::Rd_expr_doi("10.31219/osf.io/ectms")