Description Usage Format Details Source References See Also Examples

Data collected at Augrabies Falls National Park (South Africa) in
September-October 2002, on the contest performance and background attributes
of 77 male flat lizards (*Platysaurus broadleyi*). The results of
exactly 100 contests were recorded, along with various measurements made on
each lizard. Full details of the study are in Whiting et al. (2006).

1 |

This dataset is a list containing two data frames:
`flatlizards$contests`

and `flatlizards$predictors`

.

The `flatlizards$contests`

data frame has 100 observations on the
following 2 variables:

- winner
a factor with 77 levels

`lizard003`

...`lizard189`

.- loser
a factor with the same 77 levels

`lizard003`

...`lizard189`

.

The `flatlizards$predictors`

data frame has 77 observations (one for
each of the 77 lizards) on the following 18 variables:

- id
factor with 77 levels (3 5 6 ... 189), the lizard identifiers.

- throat.PC1
numeric, the first principal component of the throat spectrum.

- throat.PC2
numeric, the second principal component of the throat spectrum.

- throat.PC3
numeric, the third principal component of the throat spectrum.

- frontleg.PC1
numeric, the first principal component of the front-leg spectrum.

- frontleg.PC2
numeric, the second principal component of the front-leg spectrum.

- frontleg.PC3
numeric, the third principal component of the front-leg spectrum.

- badge.PC1
numeric, the first principal component of the ventral colour patch spectrum.

- badge.PC2
numeric, the second principal component of the ventral colour patch spectrum.

- badge.PC3
numeric, the third principal component of the ventral colour patch spectrum.

- badge.size
numeric, a measure of the area of the ventral colour patch.

- testosterone
numeric, a measure of blood testosterone concentration.

- SVL
numeric, the snout-vent length of the lizard.

- head.length
numeric, head length.

- head.width
numeric, head width.

- head.height
numeric, head height.

- condition
numeric, a measure of body condition.

- repro.tactic
a factor indicating reproductive tactic; levels are

`resident`

and`floater`

.

There were no duplicate contests (no pair of lizards was seen fighting more than once), and there were no tied contests (the result of each contest was clear).

The variables `head.length`

, `head.width`

, `head.height`

and
`condition`

were all computed as residuals (of directly measured head
length, head width, head height and body mass index, respectively) from
simple least-squares regressions on `SVL`

.

Values of some predictors are missing (`NA`

) for some lizards,
‘at random’, because of instrument problems unconnected with the
value of the measurement being made.

The data were collected by Dr Martin Whiting, http://whitinglab.com/people/martin-whiting/, and they appear here with his kind permission.

Turner, H. and Firth, D. (2012) Bradley-Terry models in R: The
BradleyTerry2 package. *Journal of Statistical Software*,
**48**(9), 1–21.

Whiting, M. J., Stuart-Fox, D. M., O'Connor, D., Firth, D., Bennett, N. C.
and Blomberg, S. P. (2006). Ultraviolet signals ultra-aggression in a
lizard. *Animal Behaviour* **72**, 353–363.

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 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | ```
##
## Fit the standard Bradley-Terry model, using the bias-reduced
## maximum likelihood method:
##
result <- rep(1, nrow(flatlizards$contests))
BTmodel <- BTm(result, winner, loser, br = TRUE, data = flatlizards$contests)
summary(BTmodel)
##
## That's fairly useless, though, because of the rather small
## amount of data on each lizard. And really the scientific
## interest is not in the abilities of these particular 77
## lizards, but in the relationship between ability and the
## measured predictor variables.
##
## So next fit (by maximum likelihood) a "structured" B-T model in
## which abilities are determined by a linear predictor.
##
## This reproduces results reported in Table 1 of Whiting et al. (2006):
##
Whiting.model <- BTm(result, winner, loser,
~ throat.PC1[..] + throat.PC3[..] +
head.length[..] + SVL[..],
data = flatlizards)
summary(Whiting.model)
##
## Equivalently, fit the same model using glmmPQL:
##
Whiting.model <- BTm(result, winner, loser,
~ throat.PC1[..] + throat.PC3[..] +
head.length[..] + SVL[..] + (1|..),
sigma = 0, sigma.fixed = TRUE, data = flatlizards)
summary(Whiting.model)
##
## But that analysis assumes that the linear predictor formula for
## abilities is _perfect_, i.e., that there is no error in the linear
## predictor. This will always be unrealistic.
##
## So now fit the same predictor but with a normally distributed error
## term --- a generalized linear mixed model --- by using the BTm
## function instead of glm.
##
Whiting.model2 <- BTm(result, winner, loser,
~ throat.PC1[..] + throat.PC3[..] +
head.length[..] + SVL[..] + (1|..),
data = flatlizards, trace = TRUE)
summary(Whiting.model2)
##
## The estimated coefficients (of throat.PC1, throat.PC3,
## head.length and SVL are not changed substantially by
## the recognition of an error term in the model; but the estimated
## standard errors are larger, as expected. The main conclusions from
## Whiting et al. (2006) are unaffected.
##
## With the normally distributed random error included, it is perhaps
## at least as natural to use probit rather than logit as the link
## function:
##
require(stats)
Whiting.model3 <- BTm(result, winner, loser,
~ throat.PC1[..] + throat.PC3[..] +
head.length[..] + SVL[..] + (1|..),
family = binomial(link = "probit"),
data = flatlizards, trace = TRUE)
summary(Whiting.model3)
BTabilities(Whiting.model3)
## Note the "separate" attribute here, identifying two lizards with
## missing values of at least one predictor variable
##
## Modulo the usual scale change between logit and probit, the results
## are (as expected) very similar to Whiting.model2.
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.