library(lattice)
str(dat <- simDat102()) # Implicit default arguments
xyplot(dat$mass ~ dat$lengthN | dat$pop, xlab = 'Length', ylab = 'Mass',
main = 'Realized mass-length relationships', pch = 16, cex = 1.2,
col = rgb(0, 0, 0, 0.4))
# Fewer populations, more snakes (makes patterns perhaps easier to see ?)
str(dat <- simDat102(nPops = 16, nSample = 100))
xyplot(dat$mass ~ dat$lengthN | dat$pop, xlab = 'Length', ylab = 'Mass',
main = 'Realized mass-length relationships
(default random-coefficients model)',
pch = 16, cex = 1.2, col = rgb(0, 0, 0, 0.4))
# Revert to random intercept model (and less residual variation), fewer pops
# and more snakes. Increased sigma.alpha to emphasize the random intercepts part
str(dat <- simDat102(nPops = 16, nSample = 100, sigma.alpha = 50, sigma.beta = 0, sigma = 10))
xyplot(dat$mass ~ dat$lengthN | dat$pop, xlab = 'Length', ylab = 'Mass',
main = 'Realized mass-length relationships (random-intercepts model)',
pch = 16, cex = 1.2, col = rgb(0, 0, 0, 0.4))
# Revert to random-effects one-way ANOVA model, only random intercepts, but zero slopes
str(dat <- simDat102(nPops = 16, nSample = 100, sigma.alpha = 50,
mu.beta = 0, sigma.beta = 0, sigma = 10))
xyplot(dat$mass ~ dat$lengthN | dat$pop, xlab = 'Length', ylab = 'Mass',
main = 'Realized mass-length relationships
(one-way ANOVA model with random pop effects)',
pch = 16, cex = 1.2, col = rgb(0, 0, 0, 0.4))
# Revert to simple linear regression (= no effects of pop on either intercepts or slopes)
str(dat <- simDat102(nPops = 16, nSample = 100, sigma.alpha = 0, sigma.beta = 0, sigma = 10))
xyplot(dat$mass ~ dat$lengthN | dat$pop, xlab = 'Length', ylab = 'Mass',
main = 'Realized mass-length relationships
(de-facto a simple linear regression now)',
pch = 16, cex = 1.2, col = rgb(0, 0, 0, 0.4))
# Revert to "model-of-the-mean": no effects of either population or body length
str(dat <- simDat102(nPops = 16, nSample = 100, sigma.alpha = 0, mu.beta = 0,
sigma.beta = 0, sigma = 10))
xyplot(dat$mass ~ dat$lengthN | dat$pop, xlab = 'Length', ylab = 'Mass',
main = 'Realized mass-length relationships
("model-of-the-mean", no effects of pop or length)',
pch = 16, cex = 1.2, col = rgb(0, 0, 0, 0.4))
Run the code above in your browser using DataLab