pafi | R Documentation |
Pair-wise affinity index
pafi( assodata, presence = NULL, daterange = NULL, flips = 500, rand = 10, removesolitary = FALSE, addIDs = FALSE, exclcols = NULL, progbar = TRUE )
assodata |
data frame with association data. Can include a date column (ignored if no daterange is specified), and a focal column (if not found, column names (excluding date if found) are assumed to be "focals", i.e. individuals that are considered for calculating the index). |
presence |
optional data.frame in the form of date by ID, with 0 and 1 indicating whether an ID was present on a given day or not; first column must be a date (YYYY-MM-DD); see |
daterange |
character or date of length 2 (format YYYY-MM-DD). Ignored, if no date column is found. For |
flips |
the number of iterations WITHIN each randomization, i.e. how many dyads are swapped |
rand |
numeric. Number of times, a null association data set is created while keeping distribution of association (party) sizes constant and the number of times each individual appears. Used to assess an expected association index (which can be used to test null hypothesis that observed associations are random). |
removesolitary |
logical, by default |
addIDs |
logical, by default |
exclcols |
character string with column names (or numerical index of these) to be excluded. Normally used to exclude columns that neither represent IDs, date or focal. |
progbar |
logical, should a progress bar be displayed? by default |
Note that the algorithm for the randomization is not very efficient, i.e. it is slow. So use a small rand
to verify that the function indeed works as expected before using a “proper” value (>=1000)...
Future versions should include the possibility to differentiate between focals and other IDs, as well as a function to create artificial association data sets for testing purposes... Another thing to do is to allow the possibility to integrate neighbor data, which is essentially the same idea but could contain "parallel" data sets according to different distance categories.
Also, as of now, possible problems include cases in which a single association/party includes all individuals, i.e. this might cause a problem for the randomization test, at least in HWI()
.
To be done as well is to make sure that if there is a focal column, that the entry for the respective focal individual is set to 1, ie. to indicate presence in its own party (done in v0.34). More generally, make sure to consider the difference between party data and neighbor data!
a data.frame
Pepper et al 1999
## Not run: data(dolphins) dpr <- createnullpresence(colnames(dolphins)[2:19], from="2000-01-01", "2000-02-09") # pairwise affinity index pafi(dolphins, flips=100, rand=100) pafi(dolphins, flips=100, rand=100, presence = dpr) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.