plot_trajectories: Plot the Elo trajectories of individuals

Description Usage Arguments Details Value Author(s) References Examples

View source: R/plot_trajectories.R

Description

Plot the trajectories of Elo scores after each interaction

Usage

1
plot_trajectories(trajectories, colors = NULL)

Arguments

trajectories

The output of elo_scores with the return.trajectories option set to TRUE: an Nx(T+1) matrix (where T is the number of interactions).

colors

An optional vector of colours for each line (default = "black").

Details

Plots one set of trajectories. If the randomise option in elo_scores is set to TRUE, then the resulting matrices should be passed one at a time.

Value

Generates a plot. No data is returned.

Author(s)

Written by Damien R. Farine & Alfredo Sanchez-Tojar

Maintainer: Damien R. Farine <damien.farine@ieu.uzh.ch>

References

Sanchez-Tojar, A., Schroeder, J., Farine, D.R. (in prep) Methods for inferring dominance hierarchies and estimating their uncertainty.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
	# Set population size 
	N <- 10

	# Set shape parameters
	a = 15
	b = 3

	# Generate data
	data <- generate_interactions(N,100,a,b)

	# Extract data (and turn IDs into letters for this example)
	winners <- letters[data$interactions$Winner]
	losers <- letters[data$interactions$Loser]
	identities <- letters[data$hierarchy$ID]
	
	# Calculate Elo scores
	scores <- elo_scores(winners,losers,identities=identities,
		randomise=FALSE,return.trajectories=TRUE)
	
	# Plot results
	plot_trajectories(scores, colors=rainbow(N))
	

aniDom documentation built on March 7, 2021, 1:07 a.m.