remove_dyads {EloSteepness}R Documentation

remove interactions from matrix to increase sparseness

Description

remove interactions from matrix to increase sparseness

Usage

remove_dyads(
  m,
  removal_mode = c("mix", "by_interaction", "by_dyad"),
  stop_at = 0.5,
  max_out = NULL
)

Arguments

m

input matrix

removal_mode

character, should interactions be removed interaction by interaction ("by_interaction"), or by removing one dyad entirely at a time ("by_dyad"). Default is "mix", i.e. a random mix between the two strategies.

stop_at

numeric, fraction of unknown relationships to be reached

max_out

numeric, the number of matrices to be returned maximally. This is useful if the input matrix is fairly large. If set, this will return the input matrix plus max_out randomly selected matrices from the remaining produced matrices. So in fact, the output comprises max_out + 1 matrices (subject to the stop_at specification).

Value

a list with two items. $summary is a data frame with an overview. matrices contains the actual interaction matrices with increasing proportion of unknown relationships.

Examples

data(bonobos)
res <- remove_dyads(bonobos)
res$summary
length(res$matrices)
lapply(res$matrices, prunk)

res <- remove_dyads(bonobos, max_out = 2)
# first plus two randomly selected = 3 matrices
length(res$matrices)
res$summary

[Package EloSteepness version 0.5.0 Index]