Title: | Rank and Social Hierarchy for Gregarious Animals |
---|---|
Description: | Tools developed to facilitate the establishment of the rank and social hierarchy for gregarious animals by the Si method developed by Kondo & Hurnik (1990)<doi:10.1016/0168-1591(90)90125-W>. It is also possible to determine the number of agonistic interactions between two individuals, sociometric and dyadics matrix from dataset obtained through electronic bins. In addition, it is possible plotting the results using a bar plot, box plot, and sociogram. |
Authors: | Julia de Paula Soares Valente [aut, cre] , Matheus Deniz [aut, ctb] , Karolini Tenffen de Sousa [aut, ctb] |
Maintainer: | Julia de Paula Soares Valente <[email protected]> |
License: | GPL-3 |
Version: | 0.1.1 |
Built: | 2024-10-30 06:52:24 UTC |
Source: | CRAN |
Function to obtain the circle diagram with actor relationship from an sociomatrix.
actorSociogram(smatrix)
actorSociogram(smatrix)
smatrix |
sociomatrix |
The function actorSociogram is obtained by the sociometric matrix. Return a circular diagram with actor relationship between the animals, where the arrow shows the direction of the relationship and the line thickness indicates the number of encounters (the thicker the line, the greater the number of encounters).
Circular plot with actor information
Julia P. S. Valente, Matheus Deniz, Karolini T. de Sousa.
"There is no example" NULL
"There is no example" NULL
Generates a barplot from the variables obtained in the dvalue function (dominance value, social hierarchy and social rank)
barDom(dvalue, variable)
barDom(dvalue, variable)
dvalue |
Dominance value |
variable |
the column with social hierarchy or social rank information. |
It is a function that plots the social hierarchy or social rank information of a group in a barplot. The function uses the options provided by ggplot2.
histogram of social dominance
Julia P. S. Valente, Matheus Deniz, Karolini T. de Sousa.
"There is no example" NULL
"There is no example" NULL
Function to obtain the boxplot of social hierarchy categories from dvalue function.
bpDom(y, x)
bpDom(y, x)
y |
the column with animal information. |
x |
the column with social hierarchy or social rank information. |
It is a simple function that plots the social hierarchy or social rank information of a group in a boxplot. The function uses the options provided by ggplot2.
boxplot of social hierarchy or social rank
Julia P. S. Valente, Matheus Deniz, Karolini T. de Sousa.
"There is no example" NULL
"There is no example" NULL
Function to obtain the Sij dyadic dominance relationship from an sociomatrix.
dmatrix(smatrix)
dmatrix(smatrix)
smatrix |
sociomatrix |
The dyadic relationship is obtained by the following expression: Sij = (Xij - Xji) / (|Xij - Xji|), where Sij is the social status of the ith animal relative to the jth animal; Xij is the number of times the animal i won the animal j; Xji is the number of times the animal j won the animal i.
Dyadic matrix
Julia P. S. Valente, Matheus Deniz, Karolini T. de Sousa.
Kondo, S., & Hurnik, J. F. (1990). Stabilization of social hierarchy in dairy cows. Applied Animal Behaviour Science, 27(4), 287-297.
x <- matrix(c(0,0,1,0,0,1,0,0,2,0,0,0,0,1,0,0,0,1,0,0,2, 0,0,0,0,1,1,0,0,0,0,0,1,0,0,1,0,0,1,0,0,0, 1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0), nrow=8,byrow=TRUE,) colnames(x) <- c(1,2,3,4,5,6,8,9) rownames(x) <- c(1,2,3,4,5,6,8,9) dyadic <- dmatrix(x) print(dyadic)
x <- matrix(c(0,0,1,0,0,1,0,0,2,0,0,0,0,1,0,0,0,1,0,0,2, 0,0,0,0,1,1,0,0,0,0,0,1,0,0,1,0,0,1,0,0,0, 1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0), nrow=8,byrow=TRUE,) colnames(x) <- c(1,2,3,4,5,6,8,9) rownames(x) <- c(1,2,3,4,5,6,8,9) dyadic <- dmatrix(x) print(dyadic)
Function to obtain the dominance value, social rank and hierarchy from Sij dyadic relationship matrix.
dvalue(dmatrix)
dvalue(dmatrix)
dmatrix |
Sij dyadic relationship matrix |
The social categories (rank and hierarchy) are define according to dominance value and is obtained by the following expression: SH =(|Distance between highest(+ X) and lowest(- Y) dominance value| + 1) /(2 or 3), where "SH" is the rank or hierarchy. The rank (high and lower) and social category (dominant, intermediate and subordinate) are determined assigned according to dominance value. The choice for divide the group by rank or social category depends of the study objective. Both rank and social category are estimated by the distance between the highest (+ X) and the lowest (- Y) dominance value, plus 1 (corresponds to the dominance value zero), which determines the number of points in the range.
dominance value, social rank and social hierarchy
Julia P. S. Valente, Matheus Deniz, Karolini T. de Sousa.
Coimbra, P. A. D., Machado Filho, L. C. P., & Hötzel, M. J. (2012). Effects of social dominance, water trough location and shade availability on drinking behaviour of cows on pasture. Applied Animal Behaviour Science, 139(3-4), 175-182.
x <- matrix(c(0,-1,1,0,-1,1,0,0,1,0,-1,-1,0,1,0,0, -1,1,0,-1,1,-1,0,0,0,1,1,0,-1,0,0,0, 1,0,-1,1,0,0,1,0,-1,-1,1,0,0,0,0,1, 0,0,0,0,-1,0,0,0,0,0,0,0,0,-1,0,0), nrow=8,byrow=TRUE,) colnames(x) <- c(1,2,3,4,5,6,8,9) rownames(x) <- c(1,2,3,4,5,6,8,9) dominance <- dvalue(x) print(dominance)
x <- matrix(c(0,-1,1,0,-1,1,0,0,1,0,-1,-1,0,1,0,0, -1,1,0,-1,1,-1,0,0,0,1,1,0,-1,0,0,0, 1,0,-1,1,0,0,1,0,-1,-1,1,0,0,0,0,1, 0,0,0,0,-1,0,0,0,0,0,0,0,0,-1,0,0), nrow=8,byrow=TRUE,) colnames(x) <- c(1,2,3,4,5,6,8,9) rownames(x) <- c(1,2,3,4,5,6,8,9) dominance <- dvalue(x) print(dominance)
A database obtained from feed efficiency test of beef cattle to illustrate the functions of the socialh package.
feeding_event_data
feeding_event_data
A data frame with 90211 rows and 7 variables:
equipament identification
animal identification
date and time (dd/mm/yyyy and hour:minutes:seconds) when the animal entered at the electronic bin
date and time (dd/mm/yyyy and hour:minutes:seconds) when the animal left the electronic bin
duration of the feeding event in seconds
amount of food consumed during the visit to the bin in grams
pen identification
https://www.kaggle.com/datasets/juliavalente/data-from-visits-to-the-trough-of-nellore-cattle
data(feeding_event_data)
data(feeding_event_data)
Function to identify frequency that one animal was actor regarding the herd at bins.
freqActor(x)
freqActor(x)
x |
dataset with replacements information. |
freqActor is only applied for dataset with columns ordained and named as follows: actor and reactor.
Frequency of an animal was an actor
Julia P. S. Valente, Matheus Deniz, Karolini T. de Sousa.
x <- data.frame(actor = c(6,3,5,4,2,1,3,5,8,6,9,3,2,1,1), reactor = c(2,6,3,5,4,2,1,3,5,1,6,4,3,2,5)) freqA <- freqActor(x) print(freqA)
x <- data.frame(actor = c(6,3,5,4,2,1,3,5,8,6,9,3,2,1,1), reactor = c(2,6,3,5,4,2,1,3,5,1,6,4,3,2,5)) freqA <- freqActor(x) print(freqA)
Function to identify frequency that one animal was reactor regarding the herd at bins.
freqReactor(x)
freqReactor(x)
x |
dataset with replacements information. |
freqReactor is only applied for dataset with columns ordained and named as follows: actor and reactor.
Frequency of an animal was an reactor
Julia P. S. Valente, Matheus Deniz, Karolini T. de Sousa.
x <- data.frame(actor = c(6,3,5,4,2,1,3,5,8,6,9,3,2,1,1), reactor = c(2,6,3,5,4,2,1,3,5,1,6,4,3,2,5)) freqR <- freqReactor(x) print(freqR)
x <- data.frame(actor = c(6,3,5,4,2,1,3,5,8,6,9,3,2,1,1), reactor = c(2,6,3,5,4,2,1,3,5,1,6,4,3,2,5)) freqR <- freqReactor(x) print(freqR)
Function to obtain the linearity index improved by de Vries (1995).
improved_index(dmatrix, smatrix)
improved_index(dmatrix, smatrix)
dmatrix |
dyatic matrix |
smatrix |
sociomatrix |
The function improved_index is obtained by the following expression: h' = h(6/(n^3-n)*u), where "h'" is the linearity index, "n" is the total of animals, "u" is the unknown or tied relationships.
h' index
Julia P. S. Valente, Matheus Deniz, Karolini T. de Sousa.
de Vries, H. (1995). An improved test of linearity in dominance hierarchies containing unknown or tied relationships. Animal Behaviour, 50(5), 1375–1389.
dmatrix, smatrix
Function to obtain the linearity index developed by Landau (1951).
landau_index(dmatrix)
landau_index(dmatrix)
dmatrix |
dyadic matrix |
The function landau_index is obtained by the following expression: h = (12/n^3-n)* sum(Va - ((n-1)/2))^2, where "h" is the linearity index, "n" is the total of animals, "Va" is the total of times that animal "i" dominated other animals.
h index
Julia P. S. Valente, Matheus Deniz, Karolini T. de Sousa.
Landau, H. G. (1951). On dominance relations and the structure of animal societies: I. Effect of inherent characteristics. Bulletin of Mathematical Biophysics, 13, 1-19.
dmatrix
Function to obtain the circle diagram with reactor relationship from an sociomatrix.
reactorSociogram(smatrix)
reactorSociogram(smatrix)
smatrix |
sociomatrix |
The function reactorCircleDiagram is obtained by the sociometric matrix. Return a circular diagram with reactor relationship between the animals, where the arrow shows the direction of the relationship and the line thickness indicates the number of encounters (the thicker the line, the greater the number of encounters).
Circular plot with reactor information
Julia P. S. Valente, Matheus Deniz, Karolini T. de Sousa.
"There is no example" NULL
"There is no example" NULL
Function to identify frequency of replacements by bin from electronic bin data.
repByBin(x, sec)
repByBin(x, sec)
x |
dataset with electronic bins information. |
sec |
optimal interval (in seconds) between two different animals sequentially visited the same bin (feeder or drinker) to identify a replacement; |
repByBin is only applied for dataset with columns named as follows: equip_id (bin identification), animal_id (animal identification), IN (date - dd/mm/yyyy - and time - hh:mm:ss - when the animal entry in the bin), OUT (date - dd/mm/yyyy - and time - hh:mm:ss - when the animal left the bin).
Frequency of replacements by bin
Julia P. S. Valente, Matheus Deniz, Karolini T. de Sousa.
x <- data.frame(equip_id = as.numeric("0001"), animal_id = c(1,2,6,3,5,4,2,1,3,5,8,1,6,9,4,3,2,1,5,1)) x$IN <- c("01/08/2017 00:03:42","01/08/2017 00:05:26","01/08/2017 00:07:04","01/08/2017 00:08:15", "01/08/2017 00:10:35","01/08/2017 00:15:07","01/08/2017 00:18:13","01/08/2017 00:21:48", "01/08/2017 00:23:55","01/08/2017 00:30:14","01/08/2017 00:35:00","01/08/2017 00:38:11", "01/08/2017 00:39:05","01/08/2017 00:40:20","01/08/2017 00:42:08","01/08/2017 00:46:00", "01/08/2017 00:48:12","01/08/2017 00:49:40","01/08/2017 00:50:57","01/08/2017 00:52:36") x$OUT <-c("01/08/2017 00:05:24","01/08/2017 00:06:56","01/08/2017 00:08:12","01/08/2017 00:10:32", "01/08/2017 00:15:04","01/08/2017 00:18:10","01/08/2017 00:21:41","01/08/2017 00:23:53", "01/08/2017 00:30:10","01/08/2017 00:34:56","01/08/2017 00:37:32","01/08/2017 00:39:03", "01/08/2017 00:40:10","01/08/2017 00:41:51","01/08/2017 00:45:56","01/08/2017 00:48:10", "01/08/2017 00:49:36","01/08/2017 00:50:33","01/08/2017 00:52:32","01/08/2017 00:55:34") bins <- repByBin(x,10) print(bins)
x <- data.frame(equip_id = as.numeric("0001"), animal_id = c(1,2,6,3,5,4,2,1,3,5,8,1,6,9,4,3,2,1,5,1)) x$IN <- c("01/08/2017 00:03:42","01/08/2017 00:05:26","01/08/2017 00:07:04","01/08/2017 00:08:15", "01/08/2017 00:10:35","01/08/2017 00:15:07","01/08/2017 00:18:13","01/08/2017 00:21:48", "01/08/2017 00:23:55","01/08/2017 00:30:14","01/08/2017 00:35:00","01/08/2017 00:38:11", "01/08/2017 00:39:05","01/08/2017 00:40:20","01/08/2017 00:42:08","01/08/2017 00:46:00", "01/08/2017 00:48:12","01/08/2017 00:49:40","01/08/2017 00:50:57","01/08/2017 00:52:36") x$OUT <-c("01/08/2017 00:05:24","01/08/2017 00:06:56","01/08/2017 00:08:12","01/08/2017 00:10:32", "01/08/2017 00:15:04","01/08/2017 00:18:10","01/08/2017 00:21:41","01/08/2017 00:23:53", "01/08/2017 00:30:10","01/08/2017 00:34:56","01/08/2017 00:37:32","01/08/2017 00:39:03", "01/08/2017 00:40:10","01/08/2017 00:41:51","01/08/2017 00:45:56","01/08/2017 00:48:10", "01/08/2017 00:49:36","01/08/2017 00:50:33","01/08/2017 00:52:32","01/08/2017 00:55:34") bins <- repByBin(x,10) print(bins)
Function to identify replacements between actor and reactor from electronic bins data.
replacement(x, sec)
replacement(x, sec)
x |
dataset with electronic bins information. |
sec |
optimal interval (in seconds) between two different animals sequentially visited the same bin (feeder or drinker) to identify a replacement; |
replacement is only applied for dataset with columns named as follows: equip_id (bin identification), animal_id (animal identification), IN (date - dd/mm/yyyy - and time - hh:mm:ss - when the animal entry in the bin), OUT (date - dd/mm/yyyy - and time - hh:mm:ss - when the animal left the bin).
Replacement between two animals
Julia P. S. Valente, Matheus Deniz, Karolini T. de Sousa.
x <- data.frame(equip_id = as.numeric("0001"), animal_id = c(1,2,6,3,5,4,2,1,3,5,8,1,6,9,4,3,2,1,5,1)) x$IN <- c("01/08/2017 00:03:42","01/08/2017 00:05:26","01/08/2017 00:07:04","01/08/2017 00:08:15", "01/08/2017 00:10:35","01/08/2017 00:15:07","01/08/2017 00:18:13","01/08/2017 00:21:48", "01/08/2017 00:23:55","01/08/2017 00:30:14","01/08/2017 00:35:00","01/08/2017 00:38:11", "01/08/2017 00:39:05","01/08/2017 00:40:20","01/08/2017 00:42:08","01/08/2017 00:46:00", "01/08/2017 00:48:12","01/08/2017 00:49:40","01/08/2017 00:50:57","01/08/2017 00:52:36") x$OUT <-c("01/08/2017 00:05:24","01/08/2017 00:06:56","01/08/2017 00:08:12","01/08/2017 00:10:32", "01/08/2017 00:15:04","01/08/2017 00:18:10","01/08/2017 00:21:41","01/08/2017 00:23:53", "01/08/2017 00:30:10","01/08/2017 00:34:56","01/08/2017 00:37:32","01/08/2017 00:39:03", "01/08/2017 00:40:10","01/08/2017 00:41:51","01/08/2017 00:45:56","01/08/2017 00:48:10", "01/08/2017 00:49:36","01/08/2017 00:50:33","01/08/2017 00:52:32","01/08/2017 00:55:34") replace <- replacement(x,14) print(replace)
x <- data.frame(equip_id = as.numeric("0001"), animal_id = c(1,2,6,3,5,4,2,1,3,5,8,1,6,9,4,3,2,1,5,1)) x$IN <- c("01/08/2017 00:03:42","01/08/2017 00:05:26","01/08/2017 00:07:04","01/08/2017 00:08:15", "01/08/2017 00:10:35","01/08/2017 00:15:07","01/08/2017 00:18:13","01/08/2017 00:21:48", "01/08/2017 00:23:55","01/08/2017 00:30:14","01/08/2017 00:35:00","01/08/2017 00:38:11", "01/08/2017 00:39:05","01/08/2017 00:40:20","01/08/2017 00:42:08","01/08/2017 00:46:00", "01/08/2017 00:48:12","01/08/2017 00:49:40","01/08/2017 00:50:57","01/08/2017 00:52:36") x$OUT <-c("01/08/2017 00:05:24","01/08/2017 00:06:56","01/08/2017 00:08:12","01/08/2017 00:10:32", "01/08/2017 00:15:04","01/08/2017 00:18:10","01/08/2017 00:21:41","01/08/2017 00:23:53", "01/08/2017 00:30:10","01/08/2017 00:34:56","01/08/2017 00:37:32","01/08/2017 00:39:03", "01/08/2017 00:40:10","01/08/2017 00:41:51","01/08/2017 00:45:56","01/08/2017 00:48:10", "01/08/2017 00:49:36","01/08/2017 00:50:33","01/08/2017 00:52:32","01/08/2017 00:55:34") replace <- replacement(x,14) print(replace)
Function to obtain the square matrix contained dyadic frequency of dominance-related behaviors (actor and reactor).
smatrix(x)
smatrix(x)
x |
Replacement or agonistic interaction data table. |
The fuction smatrix is only applied for data set with columns named as follows: actor and reactor. The function form a square matrix, in which the number of "n" actors is also the number of "n" reactors.
Sociomatrix
Julia P. S. Valente, Matheus Deniz, Karolini T. de Sousa.
x <- data.frame(actor = c(6,3,5,4,2,1,3,5,8,6,9,3,2,1,1), reactor = c(2,6,3,5,4,2,1,3,5,1,6,4,3,2,5)) sociomatrix <- smatrix(x) print(sociomatrix)
x <- data.frame(actor = c(6,3,5,4,2,1,3,5,8,6,9,3,2,1,1), reactor = c(2,6,3,5,4,2,1,3,5,1,6,4,3,2,5)) sociomatrix <- smatrix(x) print(sociomatrix)