Shibao, Kutsukake, and Fukatsu (2004)
studied whether the density of aphids in a colony affected the
proportion of soldiers in that colony. They collected galls formed by
the aphid Tuberaphis styraci from host trees in Japan, and
recorded several characteristics of the galls (diameter, height, inner
surface area, number of holes) and of the aphids using that gall (number
of aphids, proportion of soldier individuals, and aphid density – no.
aphids/surface area). The variables of interest here are the % soldiers
and the aphid density (aphids/mm2).
You can find images of the castes of this aphid species from another
paper, Shibao et al. (2010) and some
videos in the supplementary material of the 2004 paper here.
Preliminaries
First, load the required packages (car, lm.beta, Rmisc) +ggplot2
Import shibao data file (shibao.csv)
shibao <- read.csv("../data/shibao.csv")
head(shibao,10)
Look at diagnostics
Do initial scatterplot, then we need to fit the model to generate
residuals, measures of influence. You’ll see here that the linear model
is quite straightforward. It is equivalent to the models we describe in
the text:
\[
\operatorname{soldiers} = \alpha + \beta_{1}(\operatorname{aphiddens}) +
\epsilon
\]
scatterplot (soldiers~aphiddens, data=shibao)
shibao.lm <- lm(soldiers~aphiddens, data=shibao)
plot(shibao.lm)
# influence.measures(shibao.lm)
augment(shibao.lm,data=shibao)
Examine model output
We’re comfortable with the diagnostics, so we can now assess the
parameters and their confidence intervals:
\[
\operatorname{\widehat{soldiers}} = 27.78 +
29.3(\operatorname{aphiddens})
\]
tidy(shibao.lm, conf.int = TRUE)
glance(shibao.lm)
anova(shibao.lm)
Analysis of Variance Table
Response: soldiers
Df Sum Sq Mean Sq F value Pr(>F)
aphiddens 1 2968 2968 39.1 2.1e-05 ***
Residuals 14 1062 76
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Get standardized coefficients
lm.beta(shibao.lm)
Call:
lm(formula = soldiers ~ aphiddens, data = shibao)
Standardized Coefficients::
(Intercept) aphiddens
NA 0.8582
Bibliography
Shibao, Harunobu, Mayako Kutsukake, and Takema Fukatsu. 2004.
“Density Triggers Soldier Production in a Social Aphid.”
Proceedings of the Royal Society of London. Series B: Biological
Sciences 271 (suppl
_3).
https://doi.org/fwhx8g.
Shibao, Harunobu, Mayako Kutsukake, Shigeru Matsuyama, Takema Fukatsu,
and Masakazu Shimada. 2010.
“Mechanisms Regulating Caste
Differentiation in an Aphid Social System.” Communicative
& Integrative Biology 3 (1): 1–5.
https://doi.org/dnj3d4.
LS0tCnRpdGxlOiAiUUsgQm94IDYuMiIKCm91dHB1dDogCiAgaHRtbF9ub3RlYm9vazoKICAgIHRoZW1lOiBmbGF0bHkKYmlibGlvZ3JhcGh5OiB3ZWJfZXguYmliCi0tLQoKYGBge3Igc2V0dXAsIGluY2x1ZGU9RkFMU0V9CmtuaXRyOjpvcHRzX2NodW5rJHNldChlY2hvID0gVFJVRSkKYGBgCgpAc2hpYmFvMjAwNCBzdHVkaWVkIHdoZXRoZXIgdGhlIGRlbnNpdHkgb2YgYXBoaWRzIGluIGEgY29sb255IGFmZmVjdGVkIHRoZSBwcm9wb3J0aW9uIG9mIHNvbGRpZXJzIGluIHRoYXQgY29sb255LiBUaGV5IGNvbGxlY3RlZCBnYWxscyBmb3JtZWQgYnkgdGhlIGFwaGlkICpUdWJlcmFwaGlzIHN0eXJhY2kqIGZyb20gaG9zdCB0cmVlcyBpbiBKYXBhbiwgYW5kIHJlY29yZGVkIHNldmVyYWwgY2hhcmFjdGVyaXN0aWNzIG9mIHRoZSBnYWxscyAoZGlhbWV0ZXIsIGhlaWdodCwgaW5uZXIgc3VyZmFjZSBhcmVhLCBudW1iZXIgb2YgaG9sZXMpIGFuZCBvZiB0aGUgYXBoaWRzIHVzaW5nIHRoYXQgZ2FsbCAobnVtYmVyIG9mIGFwaGlkcywgcHJvcG9ydGlvbiBvZiBzb2xkaWVyIGluZGl2aWR1YWxzLCBhbmQgYXBoaWQgZGVuc2l0eSAtLSBuby4gYXBoaWRzL3N1cmZhY2UgYXJlYSkuIFRoZSB2YXJpYWJsZXMgb2YgaW50ZXJlc3QgaGVyZSBhcmUgdGhlICUgc29sZGllcnMgYW5kIHRoZSBhcGhpZC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