sampling.uncertainty: Metric uncertainty

View source: R/sampling.uncertainty.R

sampling.uncertaintyR Documentation

Metric uncertainty

Description

Perform a matrix boostrapping approach to estimate the confidence intervals surrounding each pairwise association.

Usage

sampling.uncertainty(
  df,
  nboot,
  metric = "met.strength",
  assoc.indices = FALSE,
  actor = NULL,
  receiver = NULL,
  scan = NULL,
  id = NULL,
  index = "sri",
  ...
)

Arguments

df

a data frame of individual interactions or associations

nboot

an integer indicating the number of bootstrap wanted.

metric

the network metric to compute

assoc.indices

a bolean indicating if association indices must be used

actor

If argument assoc.indices is FALSE, fill this argument, an integer or a string indicating the column of the individuals performing the behaviour.

receiver

If argument assoc.indices is FALSE, fill this argument, an integer or a string indicating the column of the individuals receiving the behaviour.

scan

If argument assoc.indices is TRUE, fill this argument, a numeric or character vector representing one or more columns used as scan factors.

id

If argument assoc.indices is TRUE, fill this argument, a numeric or character vector indicating the column holding ids of individuals.

index

a string indicating the association index to compute:

...

additional argument related to the computation of the metric declared.

  • 'sri' for Simple ratio index: x/x+yAB+yA+yB

  • 'hw' for Half-weight index: x/x+yAB+1/2(yA+yB)

  • 'sr' for Square root index:x/sqr((x+yAB+yA)(x+yAB+yB))

Details

This process evaluates network metrics uncertainty by performing a boostrap with replacement on the data frame of associations and recomputing the network metric of interest.

Value

3 elements:

  • A matrix in which each column represents a node metric variation through bootstrapping, with the first row representing the original metric.

  • A summary of bootstrap distribution for each node.

  • A plot of metric variations through bootstrap

Author(s)

Sebastian Sosa

References

Lusseau, D., Whitehead, H., & Gero, S. (2009). Incorporating uncertainty into the study of animal social networks. arXiv preprint arXiv:0903.1519.

Examples

test <- sampling.uncertainty(df = sim.focal.directed, nboot = 100,
                             actor = "actor", receiver = "receiver", 
                             metric = "met.strength")

# objects returned by the function
test$metrics
test$summary
test$plot

# Example with metric extra arguments
sampling.uncertainty(df = sim.focal.directed, nboot = 100,
                     actor = "actor", receiver = "receiver", 
                     metric = "met.affinity", binary = FALSE)
sampling.uncertainty(df = sim.focal.directed, nboot = 100, 
                     actor = "actor", receiver = "receiver", 
                     metric = "met.affinity", binary = TRUE)

# Example with individual associations
sampling.uncertainty(df = sim.grp, nboot = 100, assoc.indices = TRUE, 
                     scan = c("day", "location", "time"), id = "ID")

SebastianSosa/ant documentation built on Sept. 23, 2023, 7:06 a.m.