else{ # Note that in R the { immediately follows else
Trans.density[z,Xcritical]<- Pmortality[K]þ(1-Pmortality[K])*
(1-Pbenefit[K])
} # End of else statement
} # end of z loop
Trans.density # Write out matrix
OUTPUT: (Table 6.3)
For this particular example the transition density matrix remains the same for all
times less than 13. Consider an animal (or population) commencing in state 4: it
will move to state 8 with a probability of 0.588 (or 58.8% of the population will be
in state 8), while there is a 0.412 probability that the animal will die (arbitrarily set
into state 3, Xcritical, which ensures no further progress). For an animal commenc-
ing in state 5 there is 0.02 probability of dieing, a 0.392 probability of passing into
state 4, and a 0.588 probability of passing into state 9 (Table 6.3).
MATLAB CODE: See Section 6.9.3.
6.1.7 Using the decision and transition density matrices to get expected
choices
The forgoing analyses determine the expected state an animal (or population) will
be in after some time steps. Of particular interest is the distribution of choices, as
this is what an experimenter will likely measure. To illustrate how these values
are calculated let us assume that at time t ¼ 2 our population is distributed among
the states, from x ¼ 4tox ¼ 9 as follows: 0.1, 0.1, 0.2, 0.3, 0.2, and 0.1, respectively.
Table 6.3 Transition density matrix for foraging model at time t = 2
Values of x
Values of z [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,] 0 0 0 0 0 0 0 0 0 0
....................................................................................................................................................
[2,] 0 0 0 0 0 0 0 0 0 0
....................................................................................................................................................
[3,] 0 0 0 0 0 0 0 0 0 0
....................................................................................................................................................
[4,] 0 0 0.412 0 0 0 0 0.588 0 0
....................................................................................................................................................
[5,] 0 0 0.02 0.392 0 0 0 0 0.588 0
....................................................................................................................................................
[6,] 0 0 0.02 0 0.392 0 0 0 0 0.588
....................................................................................................................................................
[7,] 0 0 0.02 0 0 0.392 0 0 0 0.588
....................................................................................................................................................
[8,] 0 0 0.004 0 0 0 0.5976 0 0 0.3984
....................................................................................................................................................
[9,] 0 0 0.004 0 0 0 0 0.5976 0 0.3984
....................................................................................................................................................
[10,] 0 0 0 0 0 0 0 0 0 0
Note: Each cell gives the probability, given that an animal is in state z at time t −1, that by
following the optimal behavior it moves into state x at time t. Output from R program is slightly
modified for display purposes.
356 MODELING EVOLUTION