> library(FSA) # mr.open
> library(FSA) # mr.open
The summarized catch data is provided in Box 6.9. These results are entered into two matrices as described in the "second method" in this vignette. For example, the "rii" portion of the table on page 255 in the book is entered with,
> s1 <- rep(NA, 5) > s2 <- c(43, rep(NA, 4)) > s3 <- c(28, 31, NA, NA, NA) > s4 <- c(12, 16, 48, NA, NA) > s5 <- c(3, 9, 19, 37, NA) > aiffd.top <- rbind(s1, s2, s3, s4, s5) > aiffd.top [,1] [,2] [,3] [,4] [,5] s1 NA NA NA NA NA s2 43 NA NA NA NA s3 28 31 NA NA NA s4 12 16 48 NA NA s5 3 9 19 37 NA
where you should note that rep() is used to repeat the first argument by the number of times in the second argument and rbind() is used to "bind" together multiple vectors of the same length in a row-wise mannger (i.e., each vector is a row in the resulting matrix. Also note that the matrix has been entered as a square 5x5 matrix where the last column, not shown in the book table, containing all blanks is needed (i.e., this column is all blanks because this the last sample such that the fish released from this sample cannot be subsequently recaptured).
As noted above, this portion of the table is a transposition of the "top" portion of the "Method B" table required by mr.open(). In other words, the rows of this table should be the columns of the required table and vice versa. Fortunately, the entire matrix can be easily transposed with t() as follows,
> mb.top <- t(aiffd.top)
> mb.top
s1 s2 s3 s4 s5
[1,] NA 43 28 12 3
[2,] NA NA 31 16 9
[3,] NA NA NA 48 19
[4,] NA NA NA NA 37
[5,] NA NA NA NA NA
The "bottom" portion of the "Method B" table required by mr.open() is constructed from some of the marginal values of the book table. However. one must be very careful to note the different definitions as outlined in the box above. This portion of the table can be constructed with,
> n <- c(643,489,712,630,NA) # m_i_ from book > m <- c(0,43,59,76,68) # r_.i_ from book > u <- n-m > R <- n # assumes no accidental deaths, thus m_i_ from book > mb.bot <- rbind(m,u,n,R) > mb.bot [,1] [,2] [,3] [,4] [,5] m 0 43 59 76 68 u 643 446 653 554 NA n 643 489 712 630 NA R 643 489 712 630 NA
Note that the book table does not show what the sample size was in the last sample. Thus, the only item known from the last sample is the number of observed marked (i.e., recaptured) fish. Fortunately, this information is not required in the Jolly-Seber calculations.
The Jolly-Seber calculations can be found in R by submitting the top and bottom portions of the Method B table as the first two arguments to mr.open() from the FSA package. The results of this function should be saved into an object so that specific parts can be extracted. For example,
> mr1 <- mr.open(mb.top, mb.bot)
The complete set of "observables" can be extracted with summary() using the type="observables" argument,
> summary(mr1, type = "observables") Observables m n R r z 1 0 643 643 86 NA 2 43 489 489 56 43 3 59 712 712 67 40 4 76 630 630 37 31 5 68 NA NA NA NA
The first three columns of this output is simply repeated from the bottom portion of the Method B table. The last two columns are computed from the top portion of the Method B table and correspond to marginal columns of the table shown in Box 6.9 (but make sure to note the different terminology).
It was noted previously that mr.open() uses the Seber (1965) modification to estimate the number of marks extant in the population (however, it does not add 1 to the mi term as shown in the text). This is not the method illustrated in Box 6.9. For comparisons purpose, the estimated number of extant marks can be calculted "by hand" using the formula for B*i (without the additional 1 on the mi term) on the bottom of page 253,
B*3 = 59+(712+1)*40/(67+1) = 478.4118 478 = M3~
B*2 = 43+(489+1)*43/(56+1) = 412.6491 413 = M2~
A2 = 1 - 478/(413-43+489) = 0.444
Estimates for these parameters can be obtained with summary() using the type="estimates" argument,
> summary(mr1, type = "estimates")
Estimates
M M.se N N.se phi phi.se B B.se
1 NA NA NA NA 0.642 0.112 NA NA
2 412.6 70.8 4595.4 1010.1 0.557 0.105 3124.7 945.2
3 478.4 80.1 5685.1 1158.8 0.522 0.115 1872.7 770.4
4 590.8 122.4 4841.2 1113.8 NA NA NA NA
5 NA NA NA NA NA NA NA NA
Standard error of phi includes sampling and individual variability.
However, you need to note that with mr.open() produces estimates of survival in the "phi" column. The mortality rates shown in the text can be found by subtracting the "phi" estimates from 1. Thus, for example A2 = 1-phi2 = 1-0.557 = 0.443 (within rounding error of the value illustrated above).
Confidence intervals for the survival estimates (phi) can be obtained with confint() using the parm="phi" argument,
> confint(mr1, parm = "phi") The Jolly method was used to construct confidence intervals. phi.lci phi.uci 1 0.423 0.861 2 0.351 0.764 3 0.296 0.748 4 NA NA 5 NA NA
Finally, note that summaries and confidence intervals of all parameter estimates can be obtained at once with summary() and confint() excluding any other arguments,
> summary(mr1)
Observables
m n R r z
1 0 643 643 86 NA
2 43 489 489 56 43
3 59 712 712 67 40
4 76 630 630 37 31
5 68 NA NA NA NA
Estimates
M M.se N N.se phi phi.se B B.se
1 NA NA NA NA 0.642 0.112 NA NA
2 412.6 70.8 4595.4 1010.1 0.557 0.105 3124.7 945.2
3 478.4 80.1 5685.1 1158.8 0.522 0.115 1872.7 770.4
4 590.8 122.4 4841.2 1113.8 NA NA NA NA
5 NA NA NA NA NA NA NA NA
Standard error of phi includes sampling and individual variability.
> confint(mr1)
The Jolly method was used to construct confidence intervals.
N.lci N.uci phi.lci phi.uci B.lci B.uci
1 NA NA 0.423 0.861 NA NA
2 2615.6 6575.2 0.351 0.764 1272.1 4977.3
3 3413.8 7956.4 0.296 0.748 362.7 3382.8
4 2658.2 7024.2 NA NA NA NA
5 NA NA NA NA NA NA