Type: | Package |
Title: | Implements New and Existing Association Indices for Constructing Animal Social Networks |
Version: | 1.0.1 |
Date: | 2017-07-05 |
Author: | William Hoppitt and Damien Farine |
Maintainer: | Damien Farine <dfarine@orn.mpg.de> |
Description: | Implements several new association indices that can control for various types of errors. Also includes existing association indices and functions for simulating the effects of different rates of error on estimates of association strength between individuals using each method. |
License: | GPL-2 |
Depends: | R (≥ 2.10) |
Suggests: | rootSolve |
NeedsCompilation: | no |
Packaged: | 2017-07-05 11:12:25 UTC; damienfarine |
Repository: | CRAN |
Date/Publication: | 2017-07-05 22:55:22 UTC |
Implements New and Existing Association Indices for Constructing Animal Social Networks ~~ assocInd ~~
Description
Implements several new association indices that can control for various types of errors. Also includes existing association indices and functions for simulating the effects of different rates of error on estimates of association strength between individuals using each method.
Details
Package: | assocInd |
Type: | Package |
Version: | 1.0.1 |
Date: | 2017-07-05 |
License: | GPL2 |
Author(s)
Authors: William Hoppitt <W.J.E.Hoppitt@leeds.ac.uk> Damien Farine <dfarine@orn.mpg.de>
Maintainer: Damien Farine <dfarine@orn.mpg.de>
References
Hoppitt, W. & Farine, D.R. (in press) Association indices for quantifying social relationships: how to deal with missing observations of individuals or groups. Animal Behaviour
The Combined Error Corrected Index
Description
Calculates the combined error corrected index
Usage
CECI(x, Ya, Yb, Yab, Ynull, w, psi, E, plot = F)
Arguments
x |
Number of times individuals a and b were observed together |
Ya |
Number of times individual a was observed without b |
Yb |
Number of times individual b was observed without a |
Yab |
Number of times individuals a and b were observed at the same time but not associating |
Ynull |
Number of times neither a or b were observed |
w |
The correction term w (see details) |
psi |
The correction term psi (see details) |
E |
The correction term Epsilon (see details) |
plot |
Flag whether to plot the results or not (default = FALSE) |
Details
The CECI calculates the probability that two individuals are observed together given that one has been seen, correcting for group location error (missing entire groups during a sampling period) and individual identification error (missing individuals that are present in a group). This index can be used if prior information is available on the observation probability of finding groups, where the correction factor w is based on calibration data suggesting that failing to observe a group containing both a and b when they are together is w times more (w > 0) or less (w < 0) likely than failing to observe both the group containing a and the group containing b when a and b are apart. E (Epsilon) is probability of missing one individual given that it is not with the other, which also requires calibration data. psi represents the relative importance of the group location error to the individual identification error (see Hoppitt & Farine in prep for how to calculate this value based on observation errors).
Value
Returns two elements: the estimated association strength and the standard error of the estimate. Also plots the function if required.
Author(s)
William Hoppitt <W.J.E.Hoppitt@leeds.ac.uk> Damien Farine <dfarine@orn.mpg.de>
References
Hoppitt, W. & Farine, D.R. (in prep) Association indices for quantifying social relationships: how to deal with missing observations of individuals or groups.
Examples
# Simulated values
x <- ya <- yb <- yab <- 10
ynull <- 0
# Set parameters to make equivalent to the SRI
psi <- 1.0
w <- 0
E <- 0
# Calculate the group location error corrected index
CECI(x,ya,yb,yab,ynull,w,psi,E)
The Group Location Error Corrected Index
Description
Calculates the Group Location Error Corrected Index
Usage
GLECI(x, Ya, Yb, Yab, Ynull, w)
Arguments
x |
Number of times individuals a and b were observed together |
Ya |
Number of times individual a was observed without b |
Yb |
Number of times individual b was observed without a |
Yab |
Number of times individuals a and b were observed at the same time but not associating |
Ynull |
Number of times neither a or b were observed |
w |
The correction term w (see details) |
Details
The GLECI calculates the probability that two individuals are observed together given that one has been seen, correcting for group location error (missing entire groups during a sampling period). This index can be used if prior information is available on the observation probability of finding groups, where the correction factor w is based on calibration data suggesting that failing to observe a group containing both a and b when they are together is w times more (w > 0) or less (w < 0) likely than failing to observe both the group containing a and the group containing b when a and b are apart.
Value
Returns two elements: the estimated association strength and the standard error of the estimate.
Author(s)
William Hoppitt <W.J.E.Hoppitt@leeds.ac.uk> Damien Farine <dfarine@orn.mpg.de>
References
Hoppitt, W. & Farine, D.R. (in prep) Association indices for quantifying social relationships: how to deal with missing observations of individuals or groups.
Examples
# Simulated values
x <- ya <- yb <- yab <- 10
ynull <- 0
# Set w (here make the GLECI equal to the SRI)
w <- 1.0
# Calculate the group location error corrected index
GLECI(x,ya,yb,yab,ynull,w)
Half-Weight Index
Description
Calculates the half-weight index
Usage
HWI(x, Ya, Yb, Yab)
Arguments
x |
Number of times individuals a and b were observed together |
Ya |
Number of times individual a was observed without b |
Yb |
Number of times individual b was observed without a |
Yab |
Number of times individuals a and b were observed at the same time but not associating |
Details
The half-weight index calculates the probability that two individuals are observed together given that one has been seen, but under the assumption that the probability of missing individuals a or b when they are together is equal to M times the probability of missing them when they are apart. This index is the most commonly used in animal social network analysis, but note that Hoppitt & Farine (in prep) and other authors argue that the weighting of the probabilities is arbitrary.
Value
Returns two elements: the estimated association strength and the standard error of the estimate.
Author(s)
William Hoppitt <W.J.E.Hoppitt@leeds.ac.uk> Damien Farine <dfarine@orn.mpg.de>
References
Hoppitt, W. & Farine, D.R. (in prep) Association indices for quantifying social relationships: how to deal with missing observations of individuals or groups.
Examples
# Simulated values (all = 10)
x <- ya <- yb <- yab <- 10
# Calculate half-weight index
HWI(x,ya,yb,yab)
M-Weight index
Description
Calculates the m-weight index, a generalisation of the half-weight index correcting for individual identification error.
Usage
MWI(x, Ya, Yb, Yab, m)
Arguments
x |
Number of times individuals a and b were observed together |
Ya |
Number of times individual a was observed without b |
Yb |
Number of times individual b was observed without a |
Yab |
Number of times individuals a and b were observed at the same time but not associating |
m |
The correction term m (see details) |
Details
The m-weight index calculates the probability that two individuals are observed together given that one has been seen, but under the assumption that the probability of missing individuals a or b when they are together is equal to m times the probability of missing them when they are apart. This index can be used if prior information is available on the observation probability of individuals when they are together versus when they are apart (defined by the ratio m).
Value
Returns two elements: the estimated association strength and the standard error of the estimate.
Author(s)
William Hoppitt <W.J.E.Hoppitt@leeds.ac.uk> Damien Farine <dfarine@orn.mpg.de>
References
Hoppitt, W. & Farine, D.R. (in prep) Association indices for quantifying social relationships: how to deal with missing observations of individuals or groups.
Examples
# Simulated values (all = 10)
x <- ya <- yb <- yab <- 10
# Set m (here make the MWI equal to the SRI)
m <- 1.0
# Calculate m-weight index
MWI(x,ya,yb,yab,m)
Simple Ratio Index
Description
Calculates the simple ratio index
Usage
SRI(x, Ya, Yb, Yab)
Arguments
x |
Number of times individuals a and b were observed together |
Ya |
Number of times individual a was observed without b |
Yb |
Number of times individual b was observed without a |
Yab |
Number of times individuals a and b were observed at the same time but not associating |
Details
The simple ratio index calculates the probability that two individuals are observed together given that one has been seen. This index is widely used in animal social network analysis.
Value
Returns two elements: the estimated association strength and the standard error of the estimate.
Author(s)
William Hoppitt <W.J.E.Hoppitt@leeds.ac.uk> Damien Farine <dfarine@orn.mpg.de>
References
Hoppitt, W. & Farine, D.R. (in prep) Association indices for quantifying social relationships: how to deal with missing observations of individuals or groups.
Examples
# Simulated values (all = 10)
x <- ya <- yb <- yab <- 10
# Calculate simple ratio index
SRI(x,ya,yb,yab)
Simulate CECI under combined group and individual location errors
Description
Generate an estimated combined error corrected index under conditions where both group and individual location errors are present, but where individual location errors are equal for all individuals
Usage
ceSimErrorsEqualCECI(aAB, w, psi, E, n)
Arguments
aAB |
The real association rate between individuals A and B |
w |
The group location error term |
psi |
The relative importance of the group location error to the individual location error |
E |
The probability of missing one individual given that it is not with the other |
n |
The number of sampling periods |
Details
A simple function that simulates data for a given probability of missing groups and real association strength. The w term represents the likelihood of failing to observe a group containing a and b compared to failing to observe both groups containing a and b if the two individuals are apart. E (Epsilon) is probability of missing one individual given that it is not with the other. psi represents the relative importance of the group location error to the individual identification error. The function returns the simulated combined error corrected index and whether the value lies within the 95 percent confidence intervals of the combined error corrected index given the number of samples and under the assumption of no error.
Value
Returns two values: the simulated combined error corrected index and whether or not it falls within the 95 percent confidence intervals (1 = yes, 0 = no)
Author(s)
William Hoppitt <W.J.E.Hoppitt@leeds.ac.uk> Damien Farine <dfarine@orn.mpg.de>
References
Hoppitt, W. & Farine, D.R. (in prep) Association indices for quantifying social relationships: how to deal with missing observations of individuals or groups.
Examples
# Set a real association index
aAB <- 0.5
# Set w range
w <- seq(-1,1,0.1)
# Set errors parameters
psi <- 0.5
E <- 0.5
# Replicate N times
replicates <- 100 # small number used to save computation time
# Create a blank storage matrices
assocStrength <- matrix(NA,nrow=replicates,ncol=length(w))
inCIs <- matrix(NA,nrow=replicates,ncol=length(w))
# Loop through repeating N times for each error value
for (i in 1:length(w)) {
for (j in 1:replicates) {
out <- ceSimErrorsEqualCECI(aAB,w[i],psi,E,20)
assocStrength[j,i] <- out[1]
inCIs[j,i] <- out[2]
}
}
# Plot the results
par(mfrow=c(1,2))
plot(w,colMeans(assocStrength, na.rm=TRUE), pch=20, ylim=c(0,1), ylab="Simulated CECI")
CIs <- apply(assocStrength,2,quantile,c(0.025,0.975),na.rm=TRUE)
arrows(w,CIs[1,],w,CIs[2,],len=0.1,code=3,angle=90)
abline(h=0.5,col="red")
plot(w,colMeans(inCIs, na.rm=TRUE), pch=20, ylim=c(0,1), ylab="Percent of times in CIs")
abline(h=0.95, col="red")
Simulate GLECI under combined group and individual location errors
Description
Generate an estimated group location error corrected index under conditions where both group and individual location errors are present, but where individual location errors are equal for all individuals
Usage
ceSimErrorsEqualGLECI(aAB, w, psi, E, n)
Arguments
aAB |
The real association rate between individuals A and B |
w |
The group location error term |
psi |
The relative importance of the group location error to the individual location error |
E |
The probability of missing one individual given that it is not with the other |
n |
The number of sampling periods |
Details
A simple function that simulates data for a given probability of missing groups and real association strength. The w term represents the likelihood of failing to observe a group containing a and b compared to failing to observe both groups containing a and b if the two individuals are apart. E (Epsilon) is probability of missing one individual given that it is not with the other. psi represents the relative importance of the group location error to the individual identification error. The function returns the simulated group location error corrected index and whether the value lies within the 95 percent confidence intervals of the group location error corrected index given the number of samples and under the assumption of no error.
Value
Returns two values: the simulated group location error corrected index and whether or not it falls within the 95 percent confidence intervals (1 = yes, 0 = no)
Author(s)
William Hoppitt <W.J.E.Hoppitt@leeds.ac.uk> Damien Farine <dfarine@orn.mpg.de>
References
Hoppitt, W. & Farine, D.R. (in prep) Association indices for quantifying social relationships: how to deal with missing observations of individuals or groups.
Examples
# Set a real association index
aAB <- 0.5
# Set w range
w <- seq(-1,1,0.1)
# Set errors parameters
psi <- 0.5
E <- 0.5
# Replicate N times
replicates <- 100 # small number used to save computation time
# Create a blank storage matrices
assocStrength <- matrix(NA,nrow=replicates,ncol=length(w))
inCIs <- matrix(NA,nrow=replicates,ncol=length(w))
# Loop through repeating N times for each error value
for (i in 1:length(w)) {
for (j in 1:replicates) {
out <- ceSimErrorsEqualGLECI(aAB,w[i],psi,E,20)
assocStrength[j,i] <- out[1]
inCIs[j,i] <- out[2]
}
}
# Plot the results
par(mfrow=c(1,2))
plot(w,colMeans(assocStrength, na.rm=TRUE), pch=20, ylim=c(0,1), ylab="Simulated GLECI")
CIs <- apply(assocStrength,2,quantile,c(0.025,0.975),na.rm=TRUE)
arrows(w,CIs[1,],w,CIs[2,],len=0.1,code=3,angle=90)
abline(h=0.5,col="red")
plot(w,colMeans(inCIs, na.rm=TRUE), pch=20, ylim=c(0,1), ylab="Percent of times in CIs")
abline(h=0.95, col="red")
Simulate SRI under combined group and individual location errors
Description
Generate an estimated simple ratio index under conditions where both group and individual location errors are present, but where individual location errors are equal for all individuals
Usage
ceSimErrorsEqualHWI(aAB, w, psi, E, n)
Arguments
aAB |
The real association rate between individuals A and B |
w |
The group location error term |
psi |
The relative importance of the group location error to the individual location error |
E |
The probability of missing one individual given that it is not with the other |
n |
The number of sampling periods |
Details
A simple function that simulates data for a given probability of missing groups and real association strength. The w term represents the likelihood of failing to observe a group containing a and b compared to failing to observe both groups containing a and b if the two individuals are apart. E (Epsilon) is probability of missing one individual given that it is not with the other. psi represents the relative importance of the group location error to the individual identification error. The function returns the simulated half weight index and whether the value lies within the 95 percent confidence intervals of the half weight index given the number of samples and under the assumption of no error.
Value
Returns two values: the simulated half weight index and whether or not it falls within the 95 percent confidence intervals (1 = yes, 0 = no)
Author(s)
William Hoppitt <W.J.E.Hoppitt@leeds.ac.uk> Damien Farine <dfarine@orn.mpg.de>
References
Hoppitt, W. & Farine, D.R. (in prep) Association indices for quantifying social relationships: how to deal with missing observations of individuals or groups.
Examples
# Set a real association index
aAB <- 0.5
# Set w range
w <- seq(-1,1,0.1)
# Set errors parameters
psi <- 0.5
E <- 0.5
# Replicate N times
replicates <- 100 # small number used to save computation time
# Create a blank storage matrices
assocStrength <- matrix(NA,nrow=replicates,ncol=length(w))
inCIs <- matrix(NA,nrow=replicates,ncol=length(w))
# Loop through repeating N times for each error value
for (i in 1:length(w)) {
for (j in 1:replicates) {
out <- ceSimErrorsEqualHWI(aAB,w[i],psi,E,20)
assocStrength[j,i] <- out[1]
inCIs[j,i] <- out[2]
}
}
# Plot the results
par(mfrow=c(1,2))
plot(w,colMeans(assocStrength, na.rm=TRUE), pch=20, ylim=c(0,1), ylab="Simulated HWI")
CIs <- apply(assocStrength,2,quantile,c(0.025,0.975),na.rm=TRUE)
arrows(w,CIs[1,],w,CIs[2,],len=0.1,code=3,angle=90)
abline(h=0.5,col="red")
plot(w,colMeans(inCIs, na.rm=TRUE), pch=20, ylim=c(0,1), ylab="Percent of times in CIs")
abline(h=0.95, col="red")
Simulate SRI under combined group and individual location errors
Description
Generate an estimated simple ratio index under conditions where both group and individual location errors are present, but where individual location errors are equal for all individuals
Usage
ceSimErrorsEqualSRI(aAB, w, psi, E, n)
Arguments
aAB |
The real association rate between individuals A and B |
w |
The group location error term |
psi |
The relative importance of the group location error to the individual location error |
E |
The probability of missing one individual given that it is not with the other |
n |
The number of sampling periods |
Details
A simple function that simulates data for a given probability of missing groups and real association strength. The w term represents the likelihood of failing to observe a group containing a and b compared to failing to observe both groups containing a and b if the two individuals are apart. E (Epsilon) is probability of missing one individual given that it is not with the other. psi represents the relative importance of the group location error to the individual identification error. The function returns the simulated simple ratio index and whether the value lies within the 95 percent confidence intervals of the simple ratio index given the number of samples and under the assumption of no error.
Value
Returns two values: the simulated simple ratio index and whether or not it falls within the 95 percent confidence intervals (1 = yes, 0 = no)
Author(s)
William Hoppitt <W.J.E.Hoppitt@leeds.ac.uk> Damien Farine <dfarine@orn.mpg.de>
References
Hoppitt, W. & Farine, D.R. (in prep) Association indices for quantifying social relationships: how to deal with missing observations of individuals or groups.
Examples
# Set a real association index
aAB <- 0.5
# Set w range
w <- seq(-1,1,0.1)
# Set errors parameters
psi <- 0.5
E <- 0.5
# Replicate N times
replicates <- 100 # small number used to save computation time
# Create a blank storage matrices
assocStrength <- matrix(NA,nrow=replicates,ncol=length(w))
inCIs <- matrix(NA,nrow=replicates,ncol=length(w))
# Loop through repeating N times for each error value
for (i in 1:length(w)) {
for (j in 1:replicates) {
out <- ceSimErrorsEqualSRI(aAB,w[i],psi,E,20)
assocStrength[j,i] <- out[1]
inCIs[j,i] <- out[2]
}
}
# Plot the results
par(mfrow=c(1,2))
plot(w,colMeans(assocStrength, na.rm=TRUE), pch=20, ylim=c(0,1), ylab="Simulated SRI")
CIs <- apply(assocStrength,2,quantile,c(0.025,0.975),na.rm=TRUE)
arrows(w,CIs[1,],w,CIs[2,],len=0.1,code=3,angle=90)
abline(h=0.5,col="red")
plot(w,colMeans(inCIs, na.rm=TRUE), pch=20, ylim=c(0,1), ylab="Percent of times in CIs")
abline(h=0.95, col="red")
Simulate vSRI under combined group and individual location errors
Description
Generate an estimated very simple ratio index under conditions where both group and individual location errors are present, but where individual location errors are equal for all individuals
Usage
ceSimErrorsEqualvSRI(aAB, w, psi, E, n)
Arguments
aAB |
The real association rate between individuals A and B |
w |
The group location error term |
psi |
The relative importance of the group location error to the individual location error |
E |
The probability of missing one individual given that it is not with the other |
n |
The number of sampling periods |
Details
A simple function that simulates data for a given probability of missing groups and real association strength. The w term represents the likelihood of failing to observe a group containing a and b compared to failing to observe both groups containing a and b if the two individuals are apart. E (Epsilon) is probability of missing one individual given that it is not with the other. psi represents the relative importance of the group location error to the individual identification error. The function returns the simulated very simple ratio index and whether the value lies within the 95 percent confidence intervals of the very simple ratio index given the number of samples and under the assumption of no error.
Value
Returns two values: the simulated very simple ratio index and whether or not it falls within the 95 percent confidence intervals (1 = yes, 0 = no)
Author(s)
William Hoppitt <W.J.E.Hoppitt@leeds.ac.uk> Damien Farine <dfarine@orn.mpg.de>
References
Hoppitt, W. & Farine, D.R. (in prep) Association indices for quantifying social relationships: how to deal with missing observations of individuals or groups.
Examples
# Set a real association index
aAB <- 0.5
# Set w range
w <- seq(-1,1,0.1)
# Set errors parameters
psi <- 0.5
E <- 0.5
# Replicate N times
replicates <- 100 # small number used to save computation time
# Create a blank storage matrices
assocStrength <- matrix(NA,nrow=replicates,ncol=length(w))
inCIs <- matrix(NA,nrow=replicates,ncol=length(w))
# Loop through repeating N times for each error value
for (i in 1:length(w)) {
for (j in 1:replicates) {
out <- ceSimErrorsEqualvSRI(aAB,w[i],psi,E,20)
assocStrength[j,i] <- out[1]
inCIs[j,i] <- out[2]
}
}
# Plot the results
par(mfrow=c(1,2))
plot(w,colMeans(assocStrength, na.rm=TRUE), pch=20, ylim=c(0,1), ylab="Simulated vSRI")
CIs <- apply(assocStrength,2,quantile,c(0.025,0.975),na.rm=TRUE)
arrows(w,CIs[1,],w,CIs[2,],len=0.1,code=3,angle=90)
abline(h=0.5,col="red")
plot(w,colMeans(inCIs, na.rm=TRUE), pch=20, ylim=c(0,1), ylab="Percent of times in CIs")
abline(h=0.95, col="red")
Simulate CECI under combined group and individual location errors with unequal observation probabilities
Description
Generate an estimated combined error correction index under conditions where both group and individual location errors are present, but where individual location errors are not equal for all individuals
Usage
ceSimErrorsUnequalCECI(aAB, w, psi, Emean, Esd, n)
Arguments
aAB |
The real association rate between individuals A and B |
w |
The group location error term |
psi |
The relative importance of the group location error to the individual location error |
Emean |
The mean probability of missing one individual given that it is not with the other |
Esd |
The standard deviation of the individual location error distribution |
n |
The number of sampling periods |
Details
A simple function that simulates data for a given probability of missing groups and real association strength. The w term represents the likelihood of failing to observe a group containing a and b compared to failing to observe both groups containing a and b if the two individuals are apart. E (Epsilon) is probability of missing one individual given that it is not with the other. psi represents the relative importance of the group location error to the individual identification error. The function allows a distribution of individual location error probabilities to be given using Emean and Esd. The function returns the simulated combined error correction index and whether the value lies within the 95 percent confidence intervals of the combined error correction index given the number of samples and under the assumption of no error.
Value
Returns two values: the simulated combined error correction index and whether or not it falls within the 95 percent confidence intervals (1 = yes, 0 = no)
Author(s)
William Hoppitt <W.J.E.Hoppitt@leeds.ac.uk> Damien Farine <dfarine@orn.mpg.de>
References
Hoppitt, W. & Farine, D.R. (in prep) Association indices for quantifying social relationships: how to deal with missing observations of individuals or groups.
Examples
# Set a real association index
aAB <- 0.5
# Set w range
w <- seq(-1,1,0.1)
# Set errors parameters
psi <- 0.5
Emean <- 0.5
Esd <- 0.05
# Replicate N times
replicates <- 100 # small number used to save computation time
# Create a blank storage matrices
assocStrength <- matrix(NA,nrow=replicates,ncol=length(w))
inCIs <- matrix(NA,nrow=replicates,ncol=length(w))
# Loop through repeating N times for each error value
for (i in 1:length(w)) {
for (j in 1:replicates) {
out <- ceSimErrorsUnequalCECI(aAB,w[i],psi,Emean,Esd,20)
assocStrength[j,i] <- out[1]
inCIs[j,i] <- out[2]
}
}
# Plot the results
par(mfrow=c(1,2))
plot(w,colMeans(assocStrength, na.rm=TRUE), pch=20, ylim=c(0,1), ylab="Simulated CECI")
CIs <- apply(assocStrength,2,quantile,c(0.025,0.975),na.rm=TRUE)
arrows(w,CIs[1,],w,CIs[2,],len=0.1,code=3,angle=90)
abline(h=0.5,col="red")
plot(w,colMeans(inCIs, na.rm=TRUE), pch=20, ylim=c(0,1), ylab="Percent of times in CIs")
abline(h=0.95, col="red")
Simulate GLECI under combined group and individual location errors with unequal observation probabilities
Description
Generate an estimated group location error corrected index under conditions where both group and individual location errors are present, but where individual location errors are not equal for all individuals
Usage
ceSimErrorsUnequalGLECI(aAB, w, psi, Emean, Esd, n)
Arguments
aAB |
The real association rate between individuals A and B |
w |
The group location error term |
psi |
The relative importance of the group location error to the individual location error |
Emean |
The mean probability of missing one individual given that it is not with the other |
Esd |
The standard deviation of the individual location error distribution |
n |
The number of sampling periods |
Details
A simple function that simulates data for a given probability of missing groups and real association strength. The w term represents the likelihood of failing to observe a group containing a and b compared to failing to observe both groups containing a and b if the two individuals are apart. E (Epsilon) is probability of missing one individual given that it is not with the other. psi represents the relative importance of the group location error to the individual identification error. The function allows a distribution of individual location error probabilities to be given using Emean and Esd. The function returns the simulated group location error corrected index and whether the value lies within the 95 percent confidence intervals of the group location error corrected index given the number of samples and under the assumption of no error.
Value
Returns two values: the simulated group location error corrected index and whether or not it falls within the 95 percent confidence intervals (1 = yes, 0 = no)
Author(s)
William Hoppitt <W.J.E.Hoppitt@leeds.ac.uk> Damien Farine <dfarine@orn.mpg.de>
References
Hoppitt, W. & Farine, D.R. (in prep) Association indices for quantifying social relationships: how to deal with missing observations of individuals or groups.
Examples
# Set a real association index
aAB <- 0.5
# Set w range
w <- seq(-1,1,0.1)
# Set errors parameters
psi <- 0.5
Emean <- 0.5
Esd <- 0.05
# Replicate N times
replicates <- 100 # small number used to save computation time
# Create a blank storage matrices
assocStrength <- matrix(NA,nrow=replicates,ncol=length(w))
inCIs <- matrix(NA,nrow=replicates,ncol=length(w))
# Loop through repeating N times for each error value
for (i in 1:length(w)) {
for (j in 1:replicates) {
out <- ceSimErrorsUnequalGLECI(aAB,w[i],psi,Emean,Esd,20)
assocStrength[j,i] <- out[1]
inCIs[j,i] <- out[2]
}
}
# Plot the results
par(mfrow=c(1,2))
plot(w,colMeans(assocStrength, na.rm=TRUE), pch=20, ylim=c(0,1), ylab="Simulated GLECI")
CIs <- apply(assocStrength,2,quantile,c(0.025,0.975),na.rm=TRUE)
arrows(w,CIs[1,],w,CIs[2,],len=0.1,code=3,angle=90)
abline(h=0.5,col="red")
plot(w,colMeans(inCIs, na.rm=TRUE), pch=20, ylim=c(0,1), ylab="Percent of times in CIs")
abline(h=0.95, col="red")
Simulate HWI under combined group and individual location errors with unequal observation probabilities
Description
Generate an estimated half weight index under conditions where both group and individual location errors are present, but where individual location errors are not equal for all individuals
Usage
ceSimErrorsUnequalHWI(aAB, w, psi, Emean, Esd, n)
Arguments
aAB |
The real association rate between individuals A and B |
w |
The group location error term |
psi |
The relative importance of the group location error to the individual location error |
Emean |
The mean probability of missing one individual given that it is not with the other |
Esd |
The standard deviation of the individual location error distribution |
n |
The number of sampling periods |
Details
A simple function that simulates data for a given probability of missing groups and real association strength. The w term represents the likelihood of failing to observe a group containing a and b compared to failing to observe both groups containing a and b if the two individuals are apart. E (Epsilon) is probability of missing one individual given that it is not with the other. psi represents the relative importance of the group location error to the individual identification error. The function allows a distribution of individual location error probabilities to be given using Emean and Esd. The function returns the simulated half weight index and whether the value lies within the 95 percent confidence intervals of the half weight index given the number of samples and under the assumption of no error.
Value
Returns two values: the simulated half weight index and whether or not it falls within the 95 percent confidence intervals (1 = yes, 0 = no)
Author(s)
William Hoppitt <W.J.E.Hoppitt@leeds.ac.uk> Damien Farine <dfarine@orn.mpg.de>
References
Hoppitt, W. & Farine, D.R. (in prep) Association indices for quantifying social relationships: how to deal with missing observations of individuals or groups.
Examples
# Set a real association index
aAB <- 0.5
# Set w range
w <- seq(-1,1,0.1)
# Set errors parameters
psi <- 0.5
Emean <- 0.5
Esd <- 0.05
# Replicate N times
replicates <- 100 # small number used to save computation time
# Create a blank storage matrices
assocStrength <- matrix(NA,nrow=replicates,ncol=length(w))
inCIs <- matrix(NA,nrow=replicates,ncol=length(w))
# Loop through repeating N times for each error value
for (i in 1:length(w)) {
for (j in 1:replicates) {
out <- ceSimErrorsUnequalHWI(aAB,w[i],psi,Emean,Esd,20)
assocStrength[j,i] <- out[1]
inCIs[j,i] <- out[2]
}
}
# Plot the results
par(mfrow=c(1,2))
plot(w,colMeans(assocStrength, na.rm=TRUE), pch=20, ylim=c(0,1), ylab="Simulated HWI")
CIs <- apply(assocStrength,2,quantile,c(0.025,0.975),na.rm=TRUE)
arrows(w,CIs[1,],w,CIs[2,],len=0.1,code=3,angle=90)
abline(h=0.5,col="red")
plot(w,colMeans(inCIs, na.rm=TRUE), pch=20, ylim=c(0,1), ylab="Percent of times in CIs")
abline(h=0.95, col="red")
Simulate SRI under combined group and individual location errors with unequal observation probabilities
Description
Generate an estimated simple ratio index under conditions where both group and individual location errors are present, but where individual location errors are not equal for all individuals
Usage
ceSimErrorsUnequalSRI(aAB, w, psi, Emean, Esd, n)
Arguments
aAB |
The real association rate between individuals A and B |
w |
The group location error term |
psi |
The relative importance of the group location error to the individual location error |
Emean |
The mean probability of missing one individual given that it is not with the other |
Esd |
The standard deviation of the individual location error distribution |
n |
The number of sampling periods |
Details
A simple function that simulates data for a given probability of missing groups and real association strength. The w term represents the likelihood of failing to observe a group containing a and b compared to failing to observe both groups containing a and b if the two individuals are apart. E (Epsilon) is probability of missing one individual given that it is not with the other. psi represents the relative importance of the group location error to the individual identification error. The function allows a distribution of individual location error probabilities to be given using Emean and Esd. The function returns the simulated simple ratio index and whether the value lies within the 95 percent confidence intervals of the simple ratio index given the number of samples and under the assumption of no error.
Value
Returns two values: the simulated simple ratio index and whether or not it falls within the 95 percent confidence intervals (1 = yes, 0 = no)
Author(s)
William Hoppitt <W.J.E.Hoppitt@leeds.ac.uk> Damien Farine <dfarine@orn.mpg.de>
References
Hoppitt, W. & Farine, D.R. (in prep) Association indices for quantifying social relationships: how to deal with missing observations of individuals or groups.
Examples
# Set a real association index
aAB <- 0.5
# Set w range
w <- seq(-1,1,0.1)
# Set errors parameters
psi <- 0.5
Emean <- 0.5
Esd <- 0.05
# Replicate N times
replicates <- 100 # small number used to save computation time
# Create a blank storage matrices
assocStrength <- matrix(NA,nrow=replicates,ncol=length(w))
inCIs <- matrix(NA,nrow=replicates,ncol=length(w))
# Loop through repeating N times for each error value
for (i in 1:length(w)) {
for (j in 1:replicates) {
out <- ceSimErrorsUnequalSRI(aAB,w[i],psi,Emean,Esd,20)
assocStrength[j,i] <- out[1]
inCIs[j,i] <- out[2]
}
}
# Plot the results
par(mfrow=c(1,2))
plot(w,colMeans(assocStrength, na.rm=TRUE), pch=20, ylim=c(0,1), ylab="Simulated SRI")
CIs <- apply(assocStrength,2,quantile,c(0.025,0.975),na.rm=TRUE)
arrows(w,CIs[1,],w,CIs[2,],len=0.1,code=3,angle=90)
abline(h=0.5,col="red")
plot(w,colMeans(inCIs, na.rm=TRUE), pch=20, ylim=c(0,1), ylab="Percent of times in CIs")
abline(h=0.95, col="red")
Simulate vSRI under combined group and individual location errors with unequal observation probabilities
Description
Generate an estimated very simple ratio index under conditions where both group and individual location errors are present, but where individual location errors are not equal for all individuals
Usage
ceSimErrorsUnequalvSRI(aAB, w, psi, Emean, Esd, n)
Arguments
aAB |
The real association rate between individuals A and B |
w |
The group location error term |
psi |
The relative importance of the group location error to the individual location error |
Emean |
The mean probability of missing one individual given that it is not with the other |
Esd |
The standard deviation of the individual location error distribution |
n |
The number of sampling periods |
Details
A simple function that simulates data for a given probability of missing groups and real association strength. The w term represents the likelihood of failing to observe a group containing a and b compared to failing to observe both groups containing a and b if the two individuals are apart. E (Epsilon) is probability of missing one individual given that it is not with the other. psi represents the relative importance of the group location error to the individual identification error. The function allows a distribution of individual location error probabilities to be given using Emean and Esd. The function returns the simulated very simple ratio index and whether the value lies within the 95 percent confidence intervals of the very simple ratio index given the number of samples and under the assumption of no error.
Value
Returns two values: the simulated very simple ratio index and whether or not it falls within the 95 percent confidence intervals (1 = yes, 0 = no)
Author(s)
William Hoppitt <W.J.E.Hoppitt@leeds.ac.uk> Damien Farine <dfarine@orn.mpg.de>
References
Hoppitt, W. & Farine, D.R. (in prep) Association indices for quantifying social relationships: how to deal with missing observations of individuals or groups.
Examples
# Set a real association index
aAB <- 0.5
# Set w range
w <- seq(-1,1,0.1)
# Set errors parameters
psi <- 0.5
Emean <- 0.5
Esd <- 0.05
# Replicate N times
replicates <- 100 # small number used to save computation time
# Create a blank storage matrices
assocStrength <- matrix(NA,nrow=replicates,ncol=length(w))
inCIs <- matrix(NA,nrow=replicates,ncol=length(w))
# Loop through repeating N times for each error value
for (i in 1:length(w)) {
for (j in 1:replicates) {
out <- ceSimErrorsUnequalvSRI(aAB,w[i],psi,Emean,Esd,20)
assocStrength[j,i] <- out[1]
inCIs[j,i] <- out[2]
}
}
# Plot the results
par(mfrow=c(1,2))
plot(w,colMeans(assocStrength, na.rm=TRUE), pch=20, ylim=c(0,1), ylab="Simulated vSRI")
CIs <- apply(assocStrength,2,quantile,c(0.025,0.975),na.rm=TRUE)
arrows(w,CIs[1,],w,CIs[2,],len=0.1,code=3,angle=90)
abline(h=0.5,col="red")
plot(w,colMeans(inCIs, na.rm=TRUE), pch=20, ylim=c(0,1), ylab="Percent of times in CIs")
abline(h=0.95, col="red")
Simulate GLECI with group location error
Description
Generate an estimated group location error corrected index under a given rate of missing observations of groups that are present
Usage
gleSimGLECI(aAB, w, pMissA, pMissB, n)
Arguments
aAB |
The real association rate between individuals A and B |
w |
The group location error term |
pMissA |
Probability of missing group A |
pMissB |
Probability of missing group A |
n |
The number of sampling periods (number of observations of the dyad) |
Details
A simple function that simulates data for a given probability of missing groups and real association strength. The w term represents the likelihood of failing to observe a group containing a and b compared to failing to observe both groups containing a and b if the two individuals are apart. The function returns the simulated group location error corrected index and whether the value lies within the 95 percent confidence intervals of the group location error corrected index given the number of samples and under the assumption of no error.
Value
Returns two values: the simulated group location error corrected index and whether or not it falls within the 95 percent confidence intervals (1 = yes, 0 = no)
Author(s)
William Hoppitt <W.J.E.Hoppitt@leeds.ac.uk> Damien Farine <dfarine@orn.mpg.de>
References
Hoppitt, W. & Farine, D.R. (in prep) Association indices for quantifying social relationships: how to deal with missing observations of individuals or groups.
Examples
# Set a real association index
aAB <- 0.5
# Set w range
w <- seq(-1,1,0.1)
# Set observation errors
pMissA <- 0.7
pMissB <- 0.7
# Replicate N times
replicates <- 100 # small number used to save computation time
# Create a blank storage matrices
assocStrength <- matrix(NA,nrow=replicates,ncol=length(w))
inCIs <- matrix(NA,nrow=replicates,ncol=length(w))
# Loop through repeating N times for each error value
for (i in 1:length(w)) {
for (j in 1:replicates) {
out <- gleSimGLECI(aAB,w[i],pMissA,pMissB,20)
assocStrength[j,i] <- out[1]
inCIs[j,i] <- out[2]
}
}
# Plot the results
par(mfrow=c(1,2))
plot(w,colMeans(assocStrength,na.rm=TRUE), pch=20, ylim=c(0,1), ylab="Simulated GLECI")
CIs <- apply(assocStrength,2,quantile,c(0.025,0.975),na.rm=TRUE)
arrows(w,CIs[1,],w,CIs[2,],len=0.1,code=3,angle=90)
abline(h=0.5,col="red")
plot(w,colMeans(inCIs, na.rm=TRUE), pch=20, ylim=c(0,1), ylab="Percent of times in CIs")
abline(h=0.95, col="red")
Simulate HWI with group location error
Description
Generate an estimated simple ratio index under a given rate of missing observations of groups that are present
Usage
gleSimHWI(aAB, w, pMissA, pMissB, n)
Arguments
aAB |
The real association rate between individuals A and B |
w |
The group location error term |
pMissA |
Probability of missing group A |
pMissB |
Probability of missing group A |
n |
The number of sampling periods (number of observations of the dyad) |
Details
A simple function that simulates data for a given probability of missing groups and real association strength. The w term represents the likelihood of failing to observe a group containing a and b compared to failing to observe both groups containing a and b if the two individuals are apart. The function returns the simulated half weight index and whether the value lies within the 95 percent confidence intervals of the half weight index given the number of samples and under the assumption of no error.
Value
Returns two values: the simulated half weight index and whether or not it falls within the 95 percent confidence intervals (1 = yes, 0 = no)
Author(s)
William Hoppitt <W.J.E.Hoppitt@leeds.ac.uk> Damien Farine <dfarine@orn.mpg.de>
References
Hoppitt, W. & Farine, D.R. (in prep) Association indices for quantifying social relationships: how to deal with missing observations of individuals or groups.
Examples
# Set a real association index
aAB <- 0.5
# Set w range
w <- seq(-1,1,0.1)
# Set observation errors
pMissA <- 0.7
pMissB <- 0.7
# Replicate N times
replicates <- 100 # small number used to save computation time
# Create a blank storage matrices
assocStrength <- matrix(NA,nrow=replicates,ncol=length(w))
inCIs <- matrix(NA,nrow=replicates,ncol=length(w))
# Loop through repeating N times for each error value
for (i in 1:length(w)) {
for (j in 1:replicates) {
out <- gleSimHWI(aAB,w[i],pMissA,pMissB,20)
assocStrength[j,i] <- out[1]
inCIs[j,i] <- out[2]
}
}
# Plot the results
par(mfrow=c(1,2))
plot(w,colMeans(assocStrength, na.rm=TRUE), pch=20, ylim=c(0,1), ylab="Simulated HWI")
CIs <- apply(assocStrength,2,quantile,c(0.025,0.975),na.rm=TRUE)
arrows(w,CIs[1,],w,CIs[2,],len=0.1,code=3,angle=90)
abline(h=0.5,col="red")
plot(w,colMeans(inCIs, na.rm=TRUE), pch=20, ylim=c(0,1), ylab="Percent of times in CIs")
abline(h=0.95, col="red")
Simulate SRI with group location error
Description
Generate an estimated simple ratio index under a given rate of missing observations of groups that are present
Usage
gleSimSRI(aAB, w, pMissA, pMissB, n)
Arguments
aAB |
The real association rate between individuals A and B |
w |
The group location error term |
pMissA |
Probability of missing group A |
pMissB |
Probability of missing group A |
n |
The number of sampling periods (number of observations of the dyad) |
Details
A simple function that simulates data for a given probability of missing groups and real association strength. The w term represents the likelihood of failing to observe a group containing a and b compared to failing to observe both groups containing a and b if the two individuals are apart. The function returns the simulated simple ratio index and whether the value lies within the 95 percent confidence intervals of the simple ratio index given the number of samples and under the assumption of no error.
Value
Returns two values: the simulated simple ratio index and whether or not it falls within the 95 percent confidence intervals (1 = yes, 0 = no)
Author(s)
William Hoppitt <W.J.E.Hoppitt@leeds.ac.uk> Damien Farine <dfarine@orn.mpg.de>
References
Hoppitt, W. & Farine, D.R. (in prep) Association indices for quantifying social relationships: how to deal with missing observations of individuals or groups.
Examples
# Set a real association index
aAB <- 0.5
# Set w range
w <- seq(-1,1,0.1)
# Set observation errors
pMissA <- 0.7
pMissB <- 0.7
# Replicate N times
replicates <- 100 # small number used to save computation time
# Create a blank storage matrices
assocStrength <- matrix(NA,nrow=replicates,ncol=length(w))
inCIs <- matrix(NA,nrow=replicates,ncol=length(w))
# Loop through repeating N times for each error value
for (i in 1:length(w)) {
for (j in 1:replicates) {
out <- gleSimSRI(aAB,w[i],pMissA,pMissB,20)
assocStrength[j,i] <- out[1]
inCIs[j,i] <- out[2]
}
}
# Plot the results
par(mfrow=c(1,2))
plot(w,colMeans(assocStrength, na.rm=TRUE), pch=20, ylim=c(0,1), ylab="Simulated SRI")
CIs <- apply(assocStrength,2,quantile,c(0.025,0.975),na.rm=TRUE)
arrows(w,CIs[1,],w,CIs[2,],len=0.1,code=3,angle=90)
abline(h=0.5,col="red")
plot(w,colMeans(inCIs, na.rm=TRUE), pch=20, ylim=c(0,1), ylab="Percent of times in CIs")
abline(h=0.95, col="red")
Simulate vSRI with group location error
Description
Generate an estimated very simple ratio index under a given rate of missing observations of groups that are present
Usage
gleSimvSRI(aAB, w, pMissA, pMissB, n)
Arguments
aAB |
The real association rate between individuals A and B |
w |
The group location error term |
pMissA |
Probability of missing group A |
pMissB |
Probability of missing group A |
n |
The number of sampling periods (number of observations of the dyad) |
Details
A simple function that simulates data for a given probability of missing groups and real association strength. The w term represents the likelihood of failing to observe a group containing a and b compared to failing to observe both groups containing a and b if the two individuals are apart. The function returns the simulated very simple ratio index and whether the value lies within the 95 percent confidence intervals of the very simple ratio index given the number of samples and under the assumption of no error.
Value
Returns two values: the simulated very simple ratio index and whether or not it falls within the 95 percent confidence intervals (1 = yes, 0 = no)
Author(s)
William Hoppitt <W.J.E.Hoppitt@leeds.ac.uk> Damien Farine <dfarine@orn.mpg.de>
References
Hoppitt, W. & Farine, D.R. (in prep) Association indices for quantifying social relationships: how to deal with missing observations of individuals or groups.
Examples
# Set a real association index
aAB <- 0.5
# Set w range
w <- seq(-1,1,0.1)
# Set observation errors
pMissA <- 0.7
pMissB <- 0.7
# Replicate N times
replicates <- 100 # small number used to save computation time
# Create a blank storage matrices
assocStrength <- matrix(NA,nrow=replicates,ncol=length(w))
inCIs <- matrix(NA,nrow=replicates,ncol=length(w))
# Loop through repeating N times for each error value
for (i in 1:length(w)) {
for (j in 1:replicates) {
out <- gleSimvSRI(aAB,w[i],pMissA,pMissB,20)
assocStrength[j,i] <- out[1]
inCIs[j,i] <- out[2]
}
}
# Plot the results
par(mfrow=c(1,2))
plot(w,colMeans(assocStrength, na.rm=TRUE), pch=20, ylim=c(0,1), ylab="Simulated vSRI")
CIs <- apply(assocStrength,2,quantile,c(0.025,0.975),na.rm=TRUE)
arrows(w,CIs[1,],w,CIs[2,],len=0.1,code=3,angle=90)
abline(h=0.5,col="red")
plot(w,colMeans(inCIs, na.rm=TRUE), pch=20, ylim=c(0,1), ylab="Percent of times in CIs")
abline(h=0.95, col="red")
Simulate HWI with individual identification error
Description
Generate an estimated half-weight index under a given rate of missing observations of one individual given that it is present
Usage
iieSimHWI(aAB, e, n)
Arguments
aAB |
The real association rate between individuals A and B |
e |
The probability of failing to observe an individual given it is present in a group |
n |
The number of sampling periods (number of observations of the dyad) |
Details
A simple function that simulates data for a given rate of identification error and real association strength. The function returns the simulated half-weight index and whether the value lies within the 95 percent confidence intervals of the half-weight index given the number of samples and under the assumption of no error.
Value
Returns two values: the simulated half weight index and whether or not it falls within the 95 percent confidence intervals (1 = yes, 0 = no)
Author(s)
William Hoppitt <W.J.E.Hoppitt@leeds.ac.uk> Damien Farine <dfarine@orn.mpg.de>
References
Hoppitt, W. & Farine, D.R. (in prep) Association indices for quantifying social relationships: how to deal with missing observations of individuals or groups.
Examples
# Set a real association index
aAB <- 0.5
# Create a range of errors
e <- seq(0,0.8,0.01)
# Replicate N times
replicates <- 100 # small number used to save computation time
# Create a blank storage matrices
assocStrength <- matrix(NA,nrow=replicates,ncol=length(e))
inCIs <- matrix(NA,nrow=replicates,ncol=length(e))
# Loop through repeating N times for each error value
for (i in 1:length(e)) {
for (j in 1:replicates) {
out <- iieSimHWI(aAB,e[i],20)
assocStrength[j,i] <- out[1]
inCIs[j,i] <- out[2]
}
}
# Plot the results
par(mfrow=c(1,2))
plot(e,colMeans(assocStrength, na.rm=TRUE), pch=20, ylim=c(0,1), ylab="Simulated HWI")
CIs <- apply(assocStrength,2,quantile,c(0.025,0.975),na.rm=TRUE)
arrows(e,CIs[1,],e,CIs[2,],len=0.1,code=3,angle=90)
abline(h=0.5,col="red")
plot(e,colMeans(inCIs, na.rm=TRUE), pch=20, ylim=c(0,1), ylab="Percent of times in CIs")
abline(h=0.95, col="red")
Simulate SRI with individual identification error
Description
Generate an estimated simple ratio index under a given rate of missing observations of one individual given that it is present
Usage
iieSimSRI(aAB, e, n)
Arguments
aAB |
The real association rate between individuals A and B |
e |
The probability of failing to observe an individual given it is present in a group |
n |
The number of sampling periods (number of observations of the dyad) |
Details
A simple function that simulates data for a given rate of identification error and real association strength. The function returns the simulated simple ratio index and whether the value lies within the 95 percent confidence intervals of the simple ratio index given the number of samples and under the assumption of no error.
Value
Returns two values: the simulated simple ratio index and whether or not it falls within the 95 percent confidence intervals (1 = yes, 0 = no)
Author(s)
William Hoppitt <W.J.E.Hoppitt@leeds.ac.uk> Damien Farine <dfarine@orn.mpg.de>
References
Hoppitt, W. & Farine, D.R. (in prep) Association indices for quantifying social relationships: how to deal with missing observations of individuals or groups.
Examples
# Set a real association index
aAB <- 0.5
# Create a range of errors
e <- seq(0,0.8,0.01)
# Replicate N times
replicates <- 100 # small number used to save computation time
# Create a blank storage matrices
assocStrength <- matrix(NA,nrow=replicates,ncol=length(e))
inCIs <- matrix(NA,nrow=replicates,ncol=length(e))
# Loop through repeating N times for each error value
for (i in 1:length(e)) {
for (j in 1:replicates) {
out <- iieSimSRI(aAB,e[i],20)
assocStrength[j,i] <- out[1]
inCIs[j,i] <- out[2]
}
}
# Plot the results
par(mfrow=c(1,2))
plot(e,colMeans(assocStrength, na.rm=TRUE), pch=20, ylim=c(0,1), ylab="Simulated SRI")
CIs <- apply(assocStrength,2,quantile,c(0.025,0.975),na.rm=TRUE)
arrows(e,CIs[1,],e,CIs[2,],len=0.1,code=3,angle=90)
abline(h=0.5,col="red")
plot(e,colMeans(inCIs, na.rm=TRUE), pch=20, ylim=c(0,1), ylab="Percent of times in CIs")
abline(h=0.95, col="red")
Simulate vSRI with individual identification error
Description
Generate an estimated very simple ratio index under a given rate of missing observations of one individual given that it is present
Usage
iieSimvSRI(aAB, e, n)
Arguments
aAB |
The real association rate between individuals A and B |
e |
The probability of failing to observe an individual given it is present in a group |
n |
The number of sampling periods (number of observations of the dyad) |
Details
A simple function that simulates data for a given rate of identification error and real association strength. The function returns the simulated very simple ratio index and whether the value lies within the 95 percent confidence intervals of the very simple ratio index given the number of samples and under the assumption of no error.
Value
Returns two values: the simulated very simple ratio index and whether or not it falls within the 95 percent confidence intervals (1 = yes, 0 = no)
Author(s)
William Hoppitt <W.J.E.Hoppitt@leeds.ac.uk> Damien Farine <dfarine@orn.mpg.de>
References
Hoppitt, W. & Farine, D.R. (in prep) Association indices for quantifying social relationships: how to deal with missing observations of individuals or groups.
Examples
# Set a real association index
aAB <- 0.5
# Create a range of errors
e <- seq(0,0.8,0.01)
# Replicate N times
replicates <- 100 # small number used to save computation time
# Create a blank storage matrices
assocStrength <- matrix(NA,nrow=replicates,ncol=length(e))
inCIs <- matrix(NA,nrow=replicates,ncol=length(e))
# Loop through repeating N times for each error value
for (i in 1:length(e)) {
for (j in 1:replicates) {
out <- iieSimvSRI(aAB,e[i],20)
assocStrength[j,i] <- out[1]
inCIs[j,i] <- out[2]
}
}
# Plot the results
par(mfrow=c(1,2))
plot(e,colMeans(assocStrength, na.rm=TRUE), pch=20, ylim=c(0,1), ylab="Simulated HWI")
CIs <- apply(assocStrength,2,quantile,c(0.025,0.975),na.rm=TRUE)
arrows(e,CIs[1,],e,CIs[2,],len=0.1,code=3,angle=90)
abline(h=0.5,col="red")
plot(e,colMeans(inCIs, na.rm=TRUE), pch=20, ylim=c(0,1), ylab="Percent of times in CIs")
abline(h=0.95, col="red")
The very Simple Ratio Index
Description
Calculates the very Simple Ratio Index
Usage
vSRI(x, Yab)
Arguments
x |
Number of times individuals a and b were observed together |
Yab |
Number of times individuals a and b were observed at the same time but not associating |
Details
The very simple ratio index calculates the probability that two individuals are observed together given that both have been seen. This index is useful if there is large individual identification error and is an unbiased estimate (however it requires the majority of groups in the study to be sampled in a given sampling period).
Value
Returns two elements: the estimated association strength and the standard error of the estimate.
Author(s)
William Hoppitt <W.J.E.Hoppitt@leeds.ac.uk> Damien Farine <dfarine@orn.mpg.de>
References
Hoppitt, W. & Farine, D.R. (in prep) Association indices for quantifying social relationships: how to deal with missing observations of individuals or groups.
Examples
# Simulated values (all = 10)
x <- yab <- 10
# Calculate very simple ratio index
vSRI(x,yab)