gen_Nmix_open: gen_Nmix_open

Description Usage Arguments Value Examples

View source: R/gen_data.R

Description

Generate a population/observation pair with the structure of an open N-mixture model. Use cbind_pop() and rbind_pop() functions to combine sub-pops to easily add covariate structures.

Usage

1
2
gen_Nmix_open(num_sites, num_times, lambda, pdet, omega, gamma,
  starts = NULL)

Arguments

num_sites

The number of observation sites.

num_times

The number of sampling occasions.

lambda

The population rate parameter (N_i \sim Poisson(λ)).

pdet

The probability of detection p (n_{it} \sim Binomial(N_i,p)).

omega

The probability of survival (S_{it} \sim Binomial(N_{it}, ω)). Either a single number, or a vector of length t-1 (omega for each sampling occassion after the first).

gamma

The recruitment rate parameter (G_{it} \sim Poisson(γ)). Either a single number, or a vector of length t-1 (gamma for each sampling occassion after the first).

starts

If not NULL, a vector of starting population values (used instead of lambda).

Value

A list object with two named matrices. Nit contains the total population per site (each row represents a site, each column a sampling occasion). nit contains the observed counts (rows=sites, columns=sampling occasions).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
pop <- gen_Nmix_open(num_sites = 5,
                     num_times = 10,
                     lambda = 50,
                     pdet = 0.4,
                     omega = 0.8,
                     gamma = 4)
pop

# example with time covariate for omega:
pop_a <- gen_Nmix_open(2,4,50,0.75,0.9,1) # survival=90%
pop_b <- gen_Nmix_open(2,4,50,0.75,0.1,1, starts=pop_a$Ni[,4]) # survival=10%, use last time observation from pop_a to start pop_b, then drop first time observation from pop_b (this makes a seamless transition between pop_a and pop_b)
pop_b <- list(Ni=pop_b$Ni[,-1], nit=pop_b$nit[,-1])
pop   <- cbind_pops(pop_a,pop_b) # combine to produce one population list
pop

mrparker909/redNMix documentation built on April 4, 2020, 12:24 a.m.