multiresultm: Incorporate demographic stochasticity into population...

Description Usage Arguments Value Author(s) Source References Examples

View source: R/multiresultm.R

Description

This function generates multinomial random numbers for state transitions and lognormal or binomial (for clutch size=1) random numbers for fertilities and returns a vector of the number of individuals per stage class at t+1.

Usage

1
multiresultm(n, T, F, varF=NULL)

Arguments

n

the vector of numbers of individuals per class at t

T

a transition T matrix

F

a fertility F matrix

varF

a matrix of inter-individual variance in fertilities, default is NULL for simulating population where clutch size = 1, so that fertilities give the probabilities of birth.

Value

The function returns a vector of the number of individuals per class at t+1.

Author(s)

Adapted to R by Patrick Nantel.

Source

Adapted from Matlab code in Box 8.11 in Morris and Doak (2002) and section 15.1.3 in Caswell (2001)

References

Caswell, H. 2001. Matrix population models. Construction, Analysis and interpretation. 2nd ed. Sinauer, Sunderland, Massachusetts.

Morris, W. F., and D. F. Doak. 2002. Quantitative conservation biology: Theory and practice of population viability analysis. Sinauer, Sunderland, Massachusetts, USA.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
data(whale)
x<-splitA(whale)
whaleT<-x$T
whaleF<-x$F

multiresultm(c(1,9,9,9),whaleT, whaleF)
multiresultm(c(1,9,9,9),whaleT, whaleF)

## create graph similar to Fig 15.3 a
reps <- 10    # number of trajectories
tmax <- 200   # length of the trajectories
totalpop <- matrix(0,tmax,reps)  # initializes totalpop matrix to store trajectories
nzero <- c(1,1,1,1) # starting population size
for (j in 1:reps) 
{
   n <- nzero
   for (i in 1:tmax) 
   {
      n <- multiresultm(n,whaleT,whaleF)
      totalpop[i,j] <- sum(n)
   } 
} 
matplot(totalpop, type = 'l', log="y",
        xlab = 'Time (years)', ylab = 'Total population')

Example output

           t+1
yearling     3
juvenile     9
mature      10
postreprod   9
           t+1
yearling     1
juvenile    10
mature       8
postreprod  10

popbio documentation built on May 4, 2018, 1:04 a.m.