View source: R/dataSimulation.R
simDat13 | R Documentation |
Simulate parasite load ~ size regressions in 3 populations of goldenring dragonflies
simDat13(nPops = 3, nSample = 100, beta.vec = c(-2, 1, 2, 4, -2, -5))
nPops |
Number of populations |
nSample |
Number of samples per population |
beta.vec |
Vector of regression coefficients |
A list of simulated data and parameters.
nPops |
Number of populations |
nSample |
Number of samples per population |
beta |
Vector of regression coefficients |
x |
Indicator for population number |
pop |
Population name (factor) |
orig.length |
Wing length, non-centered |
wing.length |
Wing length, centered |
load |
Simulated parasite loads |
Marc Kéry
str(dat <- simDat13()) # Implicit default arguments
# Revert to main-effects model with parallel lines on the log link scale
str(dat <- simDat13(nSample = 100, beta.vec = c(-2, 1, 2, 4, 0, 0)))
# Same with less strong regression coefficient
str(dat <- simDat13(nSample = 100, beta.vec = c(-2, 1, 2, 3, 0, 0)))
# Revert to simple linear Poisson regression: no effect of population (and less strong coefficient)
str(dat <- simDat13(nSample = 100, beta.vec = c(-2, 0, 0, 3, 0, 0)))
# Revert to one-way ANOVA Poisson model: no effect of wing length
# (Choose larger sample size and greater differences in the intercepts to better show patterns)
str(dat <- simDat13(nSample = 100, beta.vec = c(-1, 3, 5, 0, 0, 0)))
# Revert to Poisson "model-of-the-mean": no effects of either wing length or population
# Intercept chosen such that average parasite load is 10
str(dat <- simDat13(nSample = 100, beta.vec = c(log(10), 0, 0, 0, 0, 0)))
mean(dat$load) # Average is about 10
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.