stoch {popdemo}R Documentation

Project population dynamics

Description

Analyse long-term dynamics of a stochastic population matrix projection model.

Usage

stoch(
  A,
  what = "all",
  Aseq = "unif",
  vector = NULL,
  Astart = NULL,
  iterations = 10000,
  discard = 1000,
  PREcheck = FALSE
)

Arguments

A

a list of matrices. stoch uses project to perform a stochastic' projection where the matrix varies with each timestep. The sequence of matrices is determined using Aseq. Matrices must be square, non-negative and numeric, and all matrices must have the same dimension.

what

what should be returned. A character vector with possible entries "lambda" (to calcualate stochastic growth), "var" (to calculate variance in stochastic growth) and/or "all" (to calculate both).

Aseq

the sequence of matrices in a stochastic projection. Aseq may be either:

  • "unif" (default), which results in every matrix in A having an equal, random chance of being chosen at each timestep.

  • a square, nonnegative left-stochastic matrix describing a first-order markov chain used to choose the matrices. This should have the same dimension as the number of matrices in A.

  • a numeric vector giving a specific sequence which corresponds to the matrices in A.

  • a character vector giving a specific sequence which corresponds to the names of the matrices in A.

vector

(optional) a numeric vector describing the age/stage distribution used to calculate the projection. If vector is not specified, a random vector is generated. Long-term stochastic dynamics should usually be the same for any vector, although if all the matrices in A are reducible (see isIrreducible), that may not be the case.

Astart

(optional) in a stochastic projection, the matrix with which to initialise the projection (either numeric, corresponding to the matrices in A, or character, corresponding to the names of matrices in A). When Astart = NULL, a random initial matrix is chosen.

iterations

the number of projection intervals. The default is 1e+5.

discard

the number of initial projection intervals to discard, to discount near-term effects arising from the choice of vector. The default is 1e+3

PREcheck

many functions in popdemo first check Primitivity, Reducibility and/or Ergodicity of matrices, with associated warnings and/or errors if a matrix breaks any assumptions. Set PREcheck=FALSE if you want to bypass these checks.

Details

Calculates stochastic growth and its variance for a given stochastic population matrix projection model.

Value

A numeric vector with two possible elements: "lambda" (the stochastic population growth rate) and "var" (the variance in stochastic population growth rate). Values returned depend on what's passed to what.

Examples

  # load the Polar bear data
  ( data(Pbear) )

  # Find the stochastic growth for a time series with uniform probability of each
  # matrix
  ( lambda_unif <- stoch(Pbear, what = "lambda", Aseq = "unif") )

  # Find the variance in stochastic growth for a time series with uniform 
  # probability of each matrix
  ( var_unif <- stoch(Pbear, what = "var", Aseq = "unif") )
                 
  # Find stochastic growth and its variance for a time series with a sequence of
  # matrices where "bad" years happen with probability q
  q <- 0.5
  prob_seq <- c(rep(1-q,3)/3, rep(q,2)/2)
  Pbear_seq <- matrix(rep(prob_seq,5), 5, 5)
  ( var_unif <- stoch(Pbear, what = "var", Aseq = Pbear_seq) )
  

[Package popdemo version 1.3-1 Index]