perm.double.focal: Data stream permutation for focal sampling data .

View source: R/perm.double.focal.R

perm.double.focalR Documentation

Data stream permutation for focal sampling data .

Description

Warning, the original function (Farine 2017) uses a control factor, the number of focals and the ids of the focals.

Usage

perm.double.focal(
  obs,
  ego,
  alters,
  focal,
  nperm,
  progress = FALSE,
  index = "sri",
  measure,
  test = "median",
  df = NULL,
  dfid = NULL,
  rf,
  ...
)

Arguments

obs

a data frame of focal observations.

ego

an integer indicating the column of the focal id for the obs.

alters

an integer indicating the column of focal's alters in obs.

focal

a numeric vector indicating the focal number in obs.

nperm

an integer indicating the number of permutations to performed.

progress

a boolean indicating if the permutation process must be visible.

index

Which type of index of associations to calculate:

  • 'sri' for Simple ratio index: x \div 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))

measure

a character indicating the social network measure to compute (Only those available in ANTs)

test

a character indicating the test to realize to account for the social network measure

df

a data frame of individual characteristics in which store permutations.

dfid

an integer or a string indicating the column with individual ids in argument df.

rf

an integer (column id) or a string (column name) indicating the column holding the factor grouping multiple networks in argument df.

...

Additional arguments related to the social network measure to compute (argument measure).

Details

Pre-network permutation for focal sampling data, and for symmetric behaviour only.

References

Farine, D. R. (2017). A guide to null models for animal social network analysis. Methods in ecology and evolution, 8(10), 1309-1320.

Sosa, S. (2018). Social Network Analysis, in: Encyclopedia of Animal Cognition and Behavior. Springer.

Examples

# Single network without data frame---------------------
head(sim.focal.undirected)
t=perm.double.focal(obs = sim.focal.undirected, ego = 3, alters = 4, 
focal = 1, nperm = 10, progress = FALSE, measure = "met.strength")
# Multiple networks with data frames---------------------
d1 = data.frame("id" = names(t[[1]]), "period" = 1)
d2 = data.frame("id" = names(t[[1]]), "period" = 2)
t = list(d1, d2)
obs = list(sim.focal.undirected, sim.focal.undirected)
t =perm.double.focal(obs = obs, ego = 3, alters = 4, focal = 1, nperm = 10, 
measure = "met.strength",  df = t, dfid = "id", rf = "period")

ANTs documentation built on July 3, 2022, 1:05 a.m.

Related to perm.double.focal in ANTs...