Bias caused by incomplete sampling

Carl James Schwarz

2020-12-15

1 Location of vignette source and code.

Because of the length of time needed to run the vignettes, only static vignettes have been included with this package.

The original of the vignettes and the code can be obtained from the GitHub site at https://github.com/cschwarz-stat-sfu-ca/BTSPAS

2 Introduction

This document will illustrate the potential biases caused by incomplete sampling in the recovery strata. For example, suppose that stratification is at a weekly level. Fish are tagged and released continuously during the week. Recoveries occur from a commercial fishery that only operating for 1/2 a week (the first half). This may cause bias in estimates of abundance because, for example, fish tagged at the end of a week, may arrive at the commercial fishery in the second half of the recovery week and not be subject to capture. This causes heterogeneity in recovery probabilities that is not accounted for in the mark-recapture analysis.

A simulated population will be created and then analyzed in several ways to illustrate the potential extent of bias, and how to properly stratify the data to account for this problem.

This scenario was originally envisioned to be handled with the sampfrac argument of the BTSPAS routines. However, the actual implementation is incorrect in BTSPAS and is deprecated. This vignette shows the proper way to deal with this problem.

2.1 Experimental setup

This simulated population is modelled around a capture-capture experiment on the Taku River which flows between the US and Canada.

Returning salmon arrive and are captured at a fish wheel during several weeks. Those fish captured at the fish wheel are tagged and released (daily). They migrate upstream to a commercial fishery. The commercial fishery does not operate on all days of the week - in particular, the fishery tends to operate during the first part of the week until the quota for catch is reached. Then the fishery stops until the next week.

2.2 Generation of population

A population of 150,000 fish will be simulated arriving at the fish wheels according to a normal distribution with a mean of 42 and a standard deviation of 15. This gives a distribution of arrival times at the fish wheel of

Distribution of arrival time at wheel

Distribution of arrival time at wheel

The spikes at the start and end are where the arrival time has been truncated and fish forced to arrive in the first and last days of the run (for convenience).

If the fish wheels had a constant probability of capture, then the pooled Petersen would be unbiased regardless of what happens in the commercial fishery. Consequently, we simulate the probability of capture that varies around 0.05. The distribution of capture probabilities at the wheel is:

Distribution of cature probabilities at wheel

Distribution of cature probabilities at wheel

This is used to sample from the simulated run as it passes the wheel and the distribution of the number tagged is:

Number tagged and released at wheel

Number tagged and released at wheel

A total of 8303 fish are tagged and released.

Travel time from the wheel to the commercial fishery is simulated using a log-normal distribution with a mean (on the log scale) of log(7) days and a standard deviation on the log-scale of 0.3. This gives a distribution of travel times of:

Distribution of travel times

Distribution of travel times

The travel time was added to the time of arrival at the fish wheels giving a distribution of time of arrival in fishery of

Arrive date at fishery

Arrive date at fishery

The distribution of catchability in the commercial fishery is

Distribution of cature probabilities in fishery

Distribution of cature probabilities in fishery

The commercial fishery is assumed to run on a 3 day on/3 day off schedule throughout the season and terminates when about 99% of the run has passed the fishery (day 84). If the catchability in the commercial fishery equal for all fish, then the pooled Petersen will also be unbiased. This is clearly not the case because some fish has a probability of 0 of being captured when the fishery is not operating.

If the probability of capture in the commercial fishery is uncorrelated with the probability of capture by the tagging wheel, the pooled-Petersen is also unbiased. A plot of the probability of capture at the tagging wheels and in the commercial fishery is:

Distribution of cature-probabilities at wheel

Distribution of cature-probabilities at wheel

In this case the correlation between the tagging and recovery probability is 0.14. Schwarz and Taylor (1988) give a formula for the relative bias of the pooled Petersen if you know the correlation and variation in the probability in the two events. In this case the relative bias of the Pooled Petersen is -8%.

A non-zero correlation could arise if both the fish wheel and commercial fishery can be saturated, e.g. regardless of the number of fish arriving at the fishwheel, only a maximum number can be captured and tagged, and regardless of how many fish are available in the fishery, only a maximum can be caught. In this case, the probability of tagging and the probability of recapture is reduced when there are many fish available which could induce some correlation.

A summary of the catch by the fishery is:

Fish captured in fishery by date

Fish captured in fishery by date

Notice the “holes” in the data when the commercial fishery is not operating.

A summary of the number of fish tagged and recaptured is:

##        recover
## tagged   FALSE   TRUE
##   FALSE 137727   3970
##   TRUE    8036    267

The data were broken into 3 day strata to match the commercial fishery operations and gives rise to the following matrix of releases and recoveries:

##          tagged S1 S2 S3 S4  S5 S6  S7 S8  S9 S10 S11 S12 S13 S14 S15 S16 S17 S18 S19 S20 S21 S22 S23 S24 S25 S26 S27 S28 S29 S30 S31 S32 S33 S34 S35 S36 S37 S38
## S1           34  0  0  2  0   0  0   0  0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
## S2           37  0  0  1  0   0  0   0  0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
## S3           70  0  0  0  0   5  0   0  0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
## S4          116  0  0  0  0   6  0   4  0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
## S5          169  0  0  0  0   0  0   8  0   1   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
## S6          158  0  0  0  0   0  0   4  0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
## S7          303  0  0  0  0   0  0   2  0   9   0   1   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
## S8          596  0  0  0  0   0  0   1  0  19   0   6   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
## S9          382  0  0  0  0   0  0   0  0   3   0   7   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
## S10         506  0  0  0  0   0  0   0  0   0   0  12   0   3   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
## S11         416  0  0  0  0   0  0   0  0   0   0   1   0   2   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
## S12         769  0  0  0  0   0  0   0  0   0   0   0   0  14   0   2   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
## S13         491  0  0  0  0   0  0   0  0   0   0   0   0   2   0   9   0   2   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
## S14         385  0  0  0  0   0  0   0  0   0   0   0   0   0   0   8   0   2   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
## S15         550  0  0  0  0   0  0   0  0   0   0   0   0   0   0   3   0   2   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
## S16         573  0  0  0  0   0  0   0  0   0   0   0   0   0   0   0   0  14   0   2   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
## S17         343  0  0  0  0   0  0   0  0   0   0   0   0   0   0   0   0   0   0   5   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
## S18         529  0  0  0  0   0  0   0  0   0   0   0   0   0   0   0   0   0   0  10   0   3   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
## S19         440  0  0  0  0   0  0   0  0   0   0   0   0   0   0   0   0   0   0   4   0   8   0   2   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
## S20         433  0  0  0  0   0  0   0  0   0   0   0   0   0   0   0   0   0   0   0   0  21   0   6   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
## S21         177  0  0  0  0   0  0   0  0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   4   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
## S22         265  0  0  0  0   0  0   0  0   0   0   0   0   0   0   0   0   0   0   0   0   0   0  21   0   6   0   0   0   0   0   0   0   0   0   0   0   0   0
## S23         284  0  0  0  0   0  0   0  0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   2   0  11   0   0   0   0   0   0   0   0   0   0   0   0   0
## S24          98  0  0  0  0   0  0   0  0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   3   0   1   0   0   0   0   0   0   0   0   0   0   0
## S25          77  0  0  0  0   0  0   0  0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   1   0   1   0   0   0   0   0   0   0   0   0   0   0
##  [ reached getOption("max.print") -- omitted 9 rows ]

Notice that some columns that are all zero because of the commercial fishery.

3 Analysis of dataset stratified to the 3-day strata.

We are now back to familiar territory.

3.1 Pooled Petersen estimator

The pooled Petersen estimator of abundance is 131,314 (SE 7,623 ). Notice the negative bias in the estimate as predicted.

3.2 BTSPAS on the full dataset

We prepare the data in the usual way with the following results:

## Stratum
##  [1]  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
## n1 - number released
##  [1]  34  37  70 116 169 158 303 596 382 506 416 769 491 385 550 573 343 529 440 433 177 265 284  98  77  39  32   7  10   7   3   1   3
## u2 - number of untagged fish in the commerial fishery
##  S1  S2  S3  S4  S5  S6  S7  S8  S9 S10 S11 S12 S13 S14 S15 S16 S17 S18 S19 S20 S21 S22 S23 S24 S25 S26 S27 S28 S29 S30 S31 S32 S33 S34 S35 S36 S37 
##  14   0  52   0 132   0 285   0 383   0 415   0 396   1 424   2 403   0 418   1 383   1 384   0 187   0  89   0   0   0   0   0   0   0   0   0   0
## n1 (releases) and m2 - recoveries from each release group
##      n1 X0 X1 X2 X3 X4
## S1   34  0  0  2  0  0
## S2   37  0  1  0  0  0
## S3   70  0  0  5  0  0
## S4  116  0  6  0  4  0
## S5  169  0  0  8  0  1
## S6  158  0  4  0  0  0
## S7  303  2  0  9  0  1
## S8  596  0 19  0  6  0
## S9  382  3  0  7  0  0
## S10 506  0 12  0  3  0
## S11 416  1  0  2  0  0
## S12 769  0 14  0  2  0
## S13 491  2  0  9  0  2
## S14 385  0  8  0  2  0
## S15 550  3  0  2  0  0
## S16 573  0 14  0  2  0
## S17 343  0  0  5  0  0
## S18 529  0 10  0  3  0
## S19 440  4  0  8  0  2
## S20 433  0 21  0  6  0
## S21 177  0  0  4  0  0
## S22 265  0 21  0  6  0
## S23 284  2  0 11  0  0
## S24  98  0  3  0  1  0
## S25  77  1  0  1  0  0
## S26  39  0  1  0  0  0
## S27  32  0  0  0  0  0
## S28   7  0  0  0  0  0
## S29  10  0  0  0  0  0
## S30   7  0  0  0  0  0
## S31   3  0  0  0  0  0
## S32   1  0  0  0  0  0
## S33   3  0  0  0  0  0

BTSPAS allows you fix the probability of capture to zero for specified recovery strata. In this case, it corresponds to cases where the number of untagged fish is also zero. You need to specify the statistical week number and the value of \(p\) on the \(logit\) scale.

Because BTSPAS operates on the \(logit\) scale and \(logit(0)\) is \(-\infty\), BTSPAS uses a value of -10 (on the logit scale) to represent strata with no effort:

# are there any days where the capture probability is fixed in advance?, i.e. because no commercial fishery
takuz.logitP.fixed        <- seq(2, length(takuz.u2), 2)
takuz.logitP.fixed
##  [1]  2  4  6  8 10 12 14 16 18 20 22 24 26 28 30 32 34 36
takuz.logitP.fixed.values <- rep(-10, length(takuz.logitP.fixed))
takuz.logitP.fixed.values
##  [1] -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10 -10

We will fit the non-diagonal model with a non-parametric movement distribution. The total number of iterations, the burnin period and the number of posterior samples to retain are specified. Here, smallish values have been used so that the run time is not excessive, but values on the order 10x larger are typically used.

library(BTSPAS)
ex.3day.fit <- TimeStratPetersenNonDiagErrorNP_fit(
                  title=      takuz.title,
                  prefix=     takuz.prefix,
                  time=       takuz.sweek,
                  n1=         takuz.n1,
                  m2=         takuz.m2,
                  u2=         takuz.u2,
                  jump.after= takuz.jump.after,
                  bad.n1=     takuz.bad.n1,
                  bad.m2=     takuz.bad.m2,
                  bad.u2=     takuz.bad.u2,
                  logitP.fixed=takuz.logitP.fixed,
                  logitP.fixed.values=takuz.logitP.fixed.values,
                  n.iter=10000, n.burnin=1000, n.sims=300,
                  debug=FALSE,
                  save.output.to.files=FALSE
                  )
## 
## 
## *** Start of call to JAGS 
## Working directory:  /Users/cschwarz/Dropbox/SPAS-Bayesian/BTSPAS/vignettes 
## Initial seed for JAGS set to: 466740 
## Random number seed for chain  150103 
## Random number seed for chain  455940 
## Random number seed for chain  988640 
## Compiling model graph
##    Resolving undeclared variables
##    Allocating nodes
## Graph information:
##    Observed stochastic nodes: 70
##    Unobserved stochastic nodes: 210
##    Total graph size: 2164
## 
## Initializing model
## 
## 
  |                                                        
  |                                                  |   0%
  |                                                        
  |++++++++++                                        |  20%
  |                                                        
  |++++++++++++++++++++                              |  40%
  |                                                        
  |++++++++++++++++++++++++++++++                    |  60%
  |                                                        
  |++++++++++++++++++++++++++++++++++++++++          |  80%
  |                                                        
  |++++++++++++++++++++++++++++++++++++++++++++++++++| 100%
## 
  |                                                        
  |                                                  |   0%
  |                                                        
  |*                                                 |   2%
  |                                                        
  |**                                                |   4%
  |                                                        
  |***                                               |   7%
  |                                                        
  |****                                              |   9%
  |                                                        
  |******                                            |  11%
  |                                                        
  |*******                                           |  13%
  |                                                        
  |********                                          |  16%
  |                                                        
  |*********                                         |  18%
  |                                                        
  |**********                                        |  20%
  |                                                        
  |***********                                       |  22%
  |                                                        
  |************                                      |  24%
  |                                                        
  |*************                                     |  27%
  |                                                        
  |**************                                    |  29%
  |                                                        
  |****************                                  |  31%
  |                                                        
  |*****************                                 |  33%
  |                                                        
  |******************                                |  36%
  |                                                        
  |*******************                               |  38%
  |                                                        
  |********************                              |  40%
  |                                                        
  |*********************                             |  42%
  |                                                        
  |**********************                            |  44%
  |                                                        
  |***********************                           |  47%
  |                                                        
  |************************                          |  49%
  |                                                        
  |**************************                        |  51%
  |                                                        
  |***************************                       |  53%
  |                                                        
  |****************************                      |  56%
  |                                                        
  |*****************************                     |  58%
  |                                                        
  |******************************                    |  60%
  |                                                        
  |*******************************                   |  62%
  |                                                        
  |********************************                  |  64%
  |                                                        
  |*********************************                 |  67%
  |                                                        
  |**********************************                |  69%
  |                                                        
  |************************************              |  71%
  |                                                        
  |*************************************             |  73%
  |                                                        
  |**************************************            |  76%
  |                                                        
  |***************************************           |  78%
  |                                                        
  |****************************************          |  80%
  |                                                        
  |*****************************************         |  82%
  |                                                        
  |******************************************        |  84%
  |                                                        
  |*******************************************       |  87%
  |                                                        
  |********************************************      |  89%
  |                                                        
  |**********************************************    |  91%
  |                                                        
  |***********************************************   |  93%
  |                                                        
  |************************************************  |  96%
  |                                                        
  |************************************************* |  98%
  |                                                        
  |**************************************************| 100%
## 
## 
## *** Finished JAGS ***

3.3 Exploring the output

Fitted run curve with zeroes

Fitted run curve with zeroes

Notice that BTSPAS interpolated through the weeks where no commercial fishery ran. Estimates of the run size are very uncertain when there are few fish released and recovered near the end of the experiment.

Posterior of total population size

Posterior of total population size

Estimates of logit(p)

Estimates of logit(p)

There is variability among the recovery probabilities in the recovery strata. Notice how the strata where recovery probabilities were fixed to zero are shown.

The estimated total run size (with 95% credible interval)

##   mean     sd   2.5%    25%    50%    75%  97.5%   Rhat  n.eff 
## 148629  14629 123956 139004 147065 157226 180696      1    900

which can be compared to the real total population of 150,000 and the Pooled Petersen estimate of 131,314 (SE 7,623 ). The bias in the pooled-Petersen seems to have been resolved.

The individual estimates of the number of unmarked in each recovery stratum are:

##        mean   sd 2.5%  25%   50%   75% 97.5% Rhat n.eff
## U[1]    273  157   86  168   241   331   651    1   640
## U[2]    472  228  171  322   433   563  1013    1   350
## U[3]    730  233  395  575   685   850  1276    1   900
## U[4]   1124  415  504  848  1055  1319  2109    1   900
## U[5]   1489  349  914 1228  1451  1700  2213    1   900
## U[6]   2202  683 1173 1719  2091  2559  3800    1   650
## U[7]   2982  604 2007 2547  2904  3355  4329    1   430
## U[8]   3893 1163 2027 3107  3801  4467  6465    1   830
## U[9]   5061  883 3482 4467  4988  5627  6868    1   900
## U[10]  6059 1723 3288 4883  5838  6974  9740    1   900
## U[11]  7235 1270 5229 6313  7092  7982 10261    1   900
## U[12]  8475 2389 4480 6831  8195  9748 13914    1   330
## U[13] 10054 1890 6895 8773  9863 11142 14566    1   900
## U[14] 10791 3276 5724 8599 10315 12438 18524    1   540
## U[15]  9787 1867 6684 8502  9651 10952 13874    1   900
## U[16] 12063 4174 6431 9416 11300 13779 21875    1   900
## U[17] 10053 1998 6664 8623  9925 11193 14346    1   440
## U[18]  9527 2770 5192 7634  9197 11052 16636    1   660
## U[19]  8639 1611 5943 7462  8470  9666 12175    1   900
## U[20]  7881 2508 4595 6297  7465  8922 13591    1   620
## U[21]  5672 1004 4033 4967  5581  6248  7935    1   460
## U[22]  5427 2173 2996 4249  5092  6046  9838    1   900
## U[23]  3475  620 2479 3028  3404  3831  4883    1   900
## U[24]  2790  910 1361 2191  2640  3227  5045    1   350
## U[25]  1816  389 1224 1536  1768  2037  2756    1   410
## U[26]  1077  362  514  835  1038  1263  1900    1   650
## U[27]   780  238  447  614   741   897  1401    1   310
## U[28]   285  122  107  204   263   349   590    1   140
## U[29]   117   60   36   75   106   144   269    1   110
## U[30]    57   36   12   31    48    72   154    1    46
## U[31]    23   18    4   11    18    30    69    1    33
## U[32]    10   10    1    3     7    13    41    1    29
## U[33]     4    5    0    1     2     5    18    1    24
## U[34]     2    3    0    0     1     2     9    1    27
## U[35]     1    1    0    0     0     1     4    1    37
## U[36]     0    1    0    0     0     0     1    1    70
## U[37]     0    0    0    0     0     0     0    1   140

4 Analysis at the 6-day stratum level.

Many of the analyses stratify to the statistical week, so only part of the week is fished by the commercial fishery. As noted previously, if the fish wheels sample a constant proportion of the run, then it doesn’t matter how the recovery sample is obtained – the Pooled Petersen estimator will still be unbiased.

We simulate the coarser stratification by taking the previous simulated population and pool adjacent 3-day strata. The pooled data is:

##          tagged S1 S2  S3  S4  S5  S6  S7  S8  S9 S10 S11 S12 S13 S14 S15 S16 S17 S18 S19 S20
## S1           71  0  3   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
## S2          186  0  0  11   4   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
## S3          327  0  0   0  12   1   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
## S4          899  0  0   0   3  28   7   0   0   0   0   0   0   0   0   0   0   0   0   0   0
## S5          888  0  0   0   0   3  19   3   0   0   0   0   0   0   0   0   0   0   0   0   0
## S6         1185  0  0   0   0   0   1  16   2   0   0   0   0   0   0   0   0   0   0   0   0
## S7          876  0  0   0   0   0   0   2  17   4   0   0   0   0   0   0   0   0   0   0   0
## S8         1123  0  0   0   0   0   0   0   3  16   2   0   0   0   0   0   0   0   0   0   0
## S9          872  0  0   0   0   0   0   0   0   0  15   3   0   0   0   0   0   0   0   0   0
## S10         873  0  0   0   0   0   0   0   0   0   4  29   8   0   0   0   0   0   0   0   0
## S11         442  0  0   0   0   0   0   0   0   0   0   0  25   6   0   0   0   0   0   0   0
## S12         382  0  0   0   0   0   0   0   0   0   0   0   2  14   1   0   0   0   0   0   0
## S13         116  0  0   0   0   0   0   0   0   0   0   0   0   1   2   0   0   0   0   0   0
## S14          39  0  0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
## S15          17  0  0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
## S16           4  0  0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
## S17           3  0  0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
## untagged     NA 14 52 132 285 383 415 396 425 405 418 384 385 187  89   0   0   0   0   0   0

Notice that no recovery strata are now zero (except at the end of the study)

4.1 Pooled Petersen estimator

The pooled Petersen estimator of abundance is the same as before as there are no changes to the number tagged, recaptured, or fished. 131,314 (SE 7,623 ).

4.2 BTSPAS on the pooled dataset

We prepare the data in the usual way with the following results:

## Stratum
##  [1]  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20
## n1 - number released
##  [1]   71  186  327  899  888 1185  876 1123  872  873  442  382  116   39   17    4    3
## u2 - number of untagged fish in the commerial fishery
##  S1  S2  S3  S4  S5  S6  S7  S8  S9 S10 S11 S12 S13 S14 S15 S16 S17 S18 S19 S20 
##  14  52 132 285 383 415 396 425 405 418 384 385 187  89   0   0   0   0   0   0
## n1 and m2 - recoveries from each release group
##       n1 X0 X1 X2
## S1    71  0  3  0
## S2   186  0 11  4
## S3   327  0 12  1
## S4   899  3 28  7
## S5   888  3 19  3
## S6  1185  1 16  2
## S7   876  2 17  4
## S8  1123  3 16  2
## S9   872  0 15  3
## S10  873  4 29  8
## S11  442  0 25  6
## S12  382  2 14  1
## S13  116  1  2  0
## S14   39  0  0  0
## S15   17  0  0  0
## S16    4  0  0  0
## S17    3  0  0  0

There were no (pooled) strata where there was no commercial fishery, so we don’t restrict the \(logit(p)\) to any value.

# are there any days where the capture probability is fixed in advance?, i.e. because no commercial fishery
takuzp.logitP.fixed        <- NULL
takuzp.logitP.fixed.values <- NULL

We will fit the non-parametric model. The total number of iterations, the burnin period and the number of posterior samples to retain are specified. Here, smallish values have been used so that the run time is not excessive, but values on the order 10x larger are typically used.

library(BTSPAS)
ex.6day.fit <- TimeStratPetersenNonDiagErrorNP_fit(
                  title=      takuzp.title,
                  prefix=     takuzp.prefix,
                  time=       takuzp.sweek,
                  n1=         takuzp.n1,
                  m2=         takuzp.m2,
                  u2=         takuzp.u2,
                  jump.after= takuzp.jump.after,
                  bad.n1=     takuzp.bad.n1,
                  bad.m2=     takuzp.bad.m2,
                  bad.u2=     takuzp.bad.u2,
                  logitP.fixed=takuzp.logitP.fixed,
                  logitP.fixed.values=takuzp.logitP.fixed.values,
                  n.iter=10000, n.burnin=1000, n.sims=300,
                  debug=FALSE,
                  save.output.to.files=FALSE
                  )
## 
## 
## *** Start of call to JAGS 
## Working directory:  /Users/cschwarz/Dropbox/SPAS-Bayesian/BTSPAS/vignettes 
## Initial seed for JAGS set to: 614502 
## Random number seed for chain  151745 
## Random number seed for chain  184411 
## Random number seed for chain  204960 
## Compiling model graph
##    Resolving undeclared variables
##    Allocating nodes
## Graph information:
##    Observed stochastic nodes: 35
##    Unobserved stochastic nodes: 86
##    Total graph size: 875
## 
## Initializing model
## 
## 
  |                                                        
  |                                                  |   0%
  |                                                        
  |++++++++++                                        |  20%
  |                                                        
  |++++++++++++++++++++                              |  40%
  |                                                        
  |++++++++++++++++++++++++++++++                    |  60%
  |                                                        
  |++++++++++++++++++++++++++++++++++++++++          |  80%
  |                                                        
  |++++++++++++++++++++++++++++++++++++++++++++++++++| 100%
## 
  |                                                        
  |                                                  |   0%
  |                                                        
  |*                                                 |   2%
  |                                                        
  |**                                                |   4%
  |                                                        
  |***                                               |   7%
  |                                                        
  |****                                              |   9%
  |                                                        
  |******                                            |  11%
  |                                                        
  |*******                                           |  13%
  |                                                        
  |********                                          |  16%
  |                                                        
  |*********                                         |  18%
  |                                                        
  |**********                                        |  20%
  |                                                        
  |***********                                       |  22%
  |                                                        
  |************                                      |  24%
  |                                                        
  |*************                                     |  27%
  |                                                        
  |**************                                    |  29%
  |                                                        
  |****************                                  |  31%
  |                                                        
  |*****************                                 |  33%
  |                                                        
  |******************                                |  36%
  |                                                        
  |*******************                               |  38%
  |                                                        
  |********************                              |  40%
  |                                                        
  |*********************                             |  42%
  |                                                        
  |**********************                            |  44%
  |                                                        
  |***********************                           |  47%
  |                                                        
  |************************                          |  49%
  |                                                        
  |**************************                        |  51%
  |                                                        
  |***************************                       |  53%
  |                                                        
  |****************************                      |  56%
  |                                                        
  |*****************************                     |  58%
  |                                                        
  |******************************                    |  60%
  |                                                        
  |*******************************                   |  62%
  |                                                        
  |********************************                  |  64%
  |                                                        
  |*********************************                 |  67%
  |                                                        
  |**********************************                |  69%
  |                                                        
  |************************************              |  71%
  |                                                        
  |*************************************             |  73%
  |                                                        
  |**************************************            |  76%
  |                                                        
  |***************************************           |  78%
  |                                                        
  |****************************************          |  80%
  |                                                        
  |*****************************************         |  82%
  |                                                        
  |******************************************        |  84%
  |                                                        
  |*******************************************       |  87%
  |                                                        
  |********************************************      |  89%
  |                                                        
  |**********************************************    |  91%
  |                                                        
  |***********************************************   |  93%
  |                                                        
  |************************************************  |  96%
  |                                                        
  |************************************************* |  98%
  |                                                        
  |**************************************************| 100%
## 
## 
## *** Finished JAGS ***

4.3 Exploring the output

Fitted run curve with zeroes

Fitted run curve with zeroes

Posterior of total population size

Posterior of total population size

Estimates of logit(p)

Estimates of logit(p)

There is variability among the recovery probabilities in the recovery strata. Notice how the strata where recovery probabilities were fixed to zero are shown.

The estimated total run size (with 95% credible interval)

##   mean     sd   2.5%    25%    50%    75%  97.5%   Rhat  n.eff 
## 141019   9292 123865 134692 140649 146659 161210      1    700

which can be compared to the real total population of 150,000 and the Pooled Petersen estimate of 131,314 (SE 7,623 ). The data pooled to the 6-day strata appears to be biased, but not as much as the pooled-Petersen estimator.

The revised individual estimates of the number of unmarked in each recovery stratum are:

##        mean   sd  2.5%   25%   50%   75% 97.5% Rhat n.eff
## U[1]    549  337   167   325   473   675  1338    1   230
## U[2]   1402  449   708  1100  1332  1643  2428    1   900
## U[3]   2882  705  1805  2362  2791  3271  4561    1   900
## U[4]   5948 1133  4115  5110  5824  6668  8451    1   900
## U[5]   9870 1490  7211  8892  9764 10786 13092    1   310
## U[6]  14309 2253 10333 12719 14041 15624 19091    1   900
## U[7]  18879 3120 13744 16682 18563 20706 25897    1   900
## U[8]  18578 3055 12963 16535 18366 20445 25068    1   900
## U[9]  20027 3447 14284 17628 19706 22054 28059    1   900
## U[10] 17117 2836 12190 15086 16910 18834 23682    1   390
## U[11] 10909 1757  7723  9745 10790 12021 14619    1   200
## U[12]  6518 1109  4670  5758  6395  7152  9009    1   900
## U[13]  3635  665  2563  3154  3563  4026  5109    1   900
## U[14]  1715  493  1005  1362  1627  1958  2881    1   640
## U[15]   299  166    79   187   270   373   727    1   880
## U[16]    64   57     8    27    48    83   214    1   900
## U[17]    11   18     0     2     5    12    54    1   140
## U[18]     1    3     0     0     0     1    10    1   100

5 References

Bonner Simon, J., & Schwarz Carl, J. (2011). Smoothing Population Size Estimates for Time-Stratified MarkRecapture Experiments Using Bayesian P-Splines. Biometrics, 67, 1498–1507. https://doi.org/10.1111/j.1541-0420.2011.01599.x

Darroch, J. N. (1961). The two-sample capture-recapture census when tagging and sampling are stratified. Biometrika, 48, 241–260. https://www.jstor.org/stable/2332748

Plante, N., L.-P Rivest, and G. Tremblay. (1988). Stratified Capture-Recapture Estimation of the Size of a Closed Population. Biometrics 54, 47-60. https://www.jstor.org/stable/2533994

Schwarz, C. J., & Taylor, C. G. (1998). The use of the stratified-Petersen estimator in fisheries management with an illustration of estimating the number of pink salmon (Oncorhynchus gorbuscha) that return to spawn in the Fraser River. Canadian Journal of Fisheries and Aquatic Sciences, 55, 281–296. https://doi.org/10.1139/f97-238