simDat123: Simulate data for Chapter 12.3: Zero-inflated counts

View source: R/dataSimulation.R

simDat123R Documentation

Simulate data for Chapter 12.3: Zero-inflated counts

Description

Generate counts of hares in two landuse types when there may be zero-inflation (this is a simple general hierarchical model, see Chapters 19 and 19B in the book)

Usage

simDat123(nSites = 50, alpha = log(2), beta = log(5) - log(2), psi = 0.2)

Arguments

nSites

Number of sites

alpha

Intercept

beta

Slope for land use

psi

Zero inflation parameter (probability of structural 0)

Value

A list of simulated data and parameters.

nSites

Number of sites

alpha

Intercept

beta

Slope for land use

psi

Zero inflation parameter

w

Indicator that count is not a structural 0

C

Simulated hare counts with zero inflation

Author(s)

Marc Kéry

Examples

str(dat <- simDat123())      # Implicit default arguments

# Drop zero inflation (and make sample sizes bigger)
str(dat <- simDat123(nSites = 1000, psi = 0))     # Note 0 % of the sites have structural zeroes now

# Half of all sites have structural zeroes
str(dat <- simDat123(nSites = 1000, psi = 0.5))

# Revert to "model-of-the-mean" without zero inflation
# 0 % of the sites have structural zeroes
str(dat <- simDat123(nSites = 1000, beta = 0, psi = 0))

# Revert to "model-of-the-mean" with zero inflation
# 50 % of the sites have structural zeroes
str(dat <- simDat123(nSites = 1000, beta = 0, psi = 0.5))


ASMbook documentation built on Sept. 11, 2024, 5:38 p.m.

Related to simDat123 in ASMbook...