Learn R Programming

ASMbook (version 1.0.2)

simDat72: Simulate data for Chapter 7.2: ANOVA with fixed effects of population

Description

Simulate snout-vent length measurements of nSample smooth snakes in each of nPops populations Data are simulated under the assumptions of a model with fixed effects of populations

Usage

simDat72(nPops = 5, nSample = 10, pop.means = c(50, 40, 45, 55, 60), sigma = 5)

Value

A list of simulated data and parameters.

nPops

Number of populations

nSample

Number of samples per population

pop.means

Population means

sigma

Residual SD

pop

Indicator for population number

eps

Simulated residuals

y

Simulated lengths

Arguments

nPops

Number of populations

nSample

Samples from each population

pop.means

Vector of mean length for each population

sigma

Value for the residual standard deviation

Author

Marc Kéry

Examples

Run this code
str(dat <- simDat72())      # Implicit default arguments

# More pops, fewer snakes in each
str(dat <- simDat72(nPops = 10, nSample = 5, pop.means = runif(10,20,60)))

# Revert to "model-of-the-mean" (larger sample size to minimize sampling variability)
str(dat <- simDat72(nSample = 1000, pop.means = rep(50, 5), sigma = 5))

Run the code above in your browser using DataLab