multiresultm             package:popbio             R Documentation

_I_n_c_o_r_p_o_r_a_t_e _d_e_m_o_g_r_a_p_h_i_c _s_t_o_c_h_a_s_t_i_c_i_t_y _i_n_t_o _p_o_p_u_l_a_t_i_o_n _p_r_o_j_e_c_t_i_o_n_s

_D_e_s_c_r_i_p_t_i_o_n:

     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_.

_U_s_a_g_e:

     multiresultm(n, T, F, varF)

_A_r_g_u_m_e_n_t_s:

       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.  Use
          varF = NULL for simulating population where clutch size = 1,
          so that fertilities give the probabilities of birth.

_V_a_l_u_e:

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

_A_u_t_h_o_r(_s):

     Adapted to R by Patrick Nantel.

_S_o_u_r_c_e:

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

_R_e_f_e_r_e_n_c_e_s:

     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.

_E_x_a_m_p_l_e_s:

     data(whale)
     multiresultm(c(1,9,9,9),whale$T, whale$F,varF=NULL)
     multiresultm(c(1,9,9,9),whale$T, whale$F,varF=NULL)

     ## 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,whale$T,whale$F,varF=NULL)
           totalpop[i,j] <- sum(n)
        } 
     } 
     matplot(totalpop, type = 'l', log="y",
             xlab = 'Time (years)', ylab = 'Total population')

