Description Usage Arguments Value Author(s) See Also Examples
This function combines the functions fRanXY
, dnearneigh
and fAssoctable
, to enable the user to extract repeated expected associations over multiple permutations. Unlike fAssoctable
, this function operates in a single step where the user is only required to input the home range of interest, the association distance threshold Gprox
and those individuals to be used in the analysis. The user is offered the flexibility to include all individuals in the analysis, or a series of possible combinations of individuals based on mean group size and probability of occurance.
The output table generated by this function creates a series of 'expected' associations according to what would be expected if individuals within a population distributed themselves at random within their home range. The output table is a data frame with a permutation number, a group identifier (i.e. those individuals occurring within a defined distance threshold) and the individual id. Each line in a single permutation corresponds to a unique individual.
Note, the running time of this finction is positively related to the number of associations in the system. Running time can be decreased by reducing the number of permutations iPerm
, limiting numbers of individuals contained in the study iID
or by decreasing the maximum association distance threshold Gprox
.
1 | fAssocmatrix(sPerm, Gprox, iextract, iID)
|
sPerm |
a sequence of numbers representing the number of permutations to be run. If 100 permutations are to be run, |
Gprox |
a numeric field representing the distance threshold (max) for an association to occur |
iextract |
either a |
iID |
either a sequence of numbers |
Permutation |
a numeric vector containing the permutation number |
Group |
a numeric vector representing the group id. Individuals which occur within the distance threshold (i.e. between 0 and |
IDs |
a character vector containing the identity of the animal within each group. |
Ross Dwyer ross.dwyer@uq.edu.au
fRanXY
, fAssoctable
, fAssocmatrix
, fAssocplot
, dnearneigh
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | ## Load required packages
library(adehabitatHR)
## Load data
data(StudyArea)
data(Roos)
## Convert df into a spatial points df object
coordinates(Roos) <- ~x+y
## Estimation of UD and KUD 95% for the 10 animals
ud <- kernelUD(Roos,h="href",same4all=TRUE)
ver95 <- getverticeshr(ud,95,unin = c("m"),unout=c("ha"))
udsgdf <- as(estUDm2spixdf(ud),"SpatialGridDataFrame")
## Run 1 permutation using only the first 5 individuals using random points taken
## from within each individuals 95% KUD.
## Associations are determined if individuals are within 50 m from one another
fAssocmatrix(sPerm=1,
Gprox=50,
iextract=ver95,
iID=1:5)
## Run 20 permutations using individuals accoring to sighting probability (ave no. roos seen on survey = 6)
## Probability-weighted random points are extracted according to the UD
## Associations are determined if individuals are within 50 m from one another
## Extract sighting probability
ID_counts <- tapply(rep(1,length(Roos[[1]])),Roos[[1]],sum)
No_SurveyDays <- 400
pObs <- as.vector(ID_counts)/No_SurveyDays # proportion of time individuals found on survey
nameObs <- names(ID_counts)
TotalAnimals <- 10 # Total number of animals in study
samplesize <- 6 # Number of IDs to include in simulations (with replacement)
bootlength <- 20 # Number of permutations
ExpProb <- data.frame(Kangaroo=nameObs,Probability=pObs) # Table of Expected Probabilities
## Generate ID combinations based on observation probability (with replacements)
pID <- sapply(1:bootlength,function(i) sample(x=TotalAnimals,
size=samplesize,
replace=FALSE,
prob=pObs))
## What individuals are contained in the first permutation?
nameObs[pID[,1]]
## What individuals are contained in the last permutation?
nameObs[pID[,bootlength]]
## Run association matrix function to generate multiple permutations of 'expected' associations
AMud_50m <- fAssocmatrix(sPerm=1:bootlength,
Gprox=50,
iextract=udsgdf,
iID=pID)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.