Bias caused by incomplete sampling

Carl James Schwarz

2020-09-04

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: 2162
## 
## 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 
## 150725  15558 125600 140375 149593 159128 185923      1    520

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]    262  169   83  156   218   320   725    1   900
## U[2]    458  229  170  311   412   550  1061    1   900
## U[3]    715  232  361  555   689   830  1293    1   900
## U[4]   1101  457  504  799  1014  1292  2166    1   900
## U[5]   1477  362  927 1219  1429  1675  2258    1   900
## U[6]   2261  865 1062 1729  2093  2647  4224    1   900
## U[7]   2997  593 2052 2578  2927  3353  4375    1   900
## U[8]   3959 1185 2035 3157  3788  4602  6756    1   900
## U[9]   5106  855 3686 4486  5019  5621  7030    1   330
## U[10]  6194 1848 3307 5003  5894  7090 10458    1   900
## U[11]  7286 1297 5051 6388  7168  8095 10184    1   730
## U[12]  8605 3100 4238 6855  8223  9965 14400    1   790
## U[13] 10089 1922 6838 8713  9859 11322 14057    1   610
## U[14] 11189 3507 6095 8845 10693 12814 19569    1   820
## U[15]  9971 1939 6720 8662  9759 11168 14195    1   660
## U[16] 12395 4106 6610 9605 11714 14154 23316    1   420
## U[17] 10098 1853 6877 8788 10020 11209 14157    1   700
## U[18]  9851 5044 5121 7670  9316 11035 17354    1   140
## U[19]  8687 1646 6080 7496  8585  9646 12335    1   260
## U[20]  7973 3067 4347 6159  7396  8907 15512    1   580
## U[21]  5637  909 4040 5015  5607  6152  7657    1   170
## U[22]  5438 2150 2942 4208  5024  5998 10829    1   900
## U[23]  3439  600 2462 3015  3393  3816  4759    1   900
## U[24]  2929 1117 1427 2269  2742  3345  5518    1   130
## U[25]  1849  370 1262 1579  1801  2061  2666    1   180
## U[26]  1129  423  497  850  1062  1338  2105    1   900
## U[27]   810  264  465  643   761   918  1416    1   790
## U[28]   294  138   94  203   277   359   627    1    35
## U[29]   117   69   22   69   103   152   290    1    15
## U[30]    61   42    5   29    53    82   166    1     9
## U[31]    25   22    1    9    20    35    86    1    16
## U[32]    11   13    0    3     8    16    41    1    22
## U[33]     5    6    0    1     3     6    20    1    29
## U[34]     2    3    0    0     1     2     9    1    66
## U[35]     1    1    0    0     0     1     4    1    96
## U[36]     0    1    0    0     0     0     2    1   350
## U[37]     0    0    0    0     0     0     1    1   780

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: 795576 
## Random number seed for chain  169244 
## Random number seed for chain  473971 
## Random number seed for chain  138948 
## Compiling model graph
##    Resolving undeclared variables
##    Allocating nodes
## Graph information:
##    Observed stochastic nodes: 35
##    Unobserved stochastic nodes: 86
##    Total graph size: 873
## 
## 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 
## 139955   9506 121684 133518 139655 146393 157919      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 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]    495  259   161   323   434   601  1173    1   900
## U[2]   1366  423   706  1075  1322  1600  2376    1   900
## U[3]   2915  698  1767  2407  2857  3334  4435    1   710
## U[4]   6031 1124  4206  5289  5884  6677  8619    1   900
## U[5]   9807 1498  7143  8743  9711 10802 12898    1   900
## U[6]  14182 2246 10494 12557 13977 15579 19406    1   900
## U[7]  19029 3154 13883 16745 18751 20825 25829    1   900
## U[8]  18273 3129 13016 16008 17971 20183 25126    1   470
## U[9]  19333 3257 13709 17077 19122 21361 26592    1   900
## U[10] 17043 2838 12225 15027 16727 18605 23525    1   900
## U[11] 10903 1618  7905  9812 10831 11911 14414    1   900
## U[12]  6625 1080  4775  5893  6513  7214  9204    1   900
## U[13]  3666  658  2599  3197  3596  4057  5155    1   830
## U[14]  1670  510   940  1335  1584  1882  2998    1   270
## U[15]   258  141    77   168   233   311   634    1   110
## U[16]    47   47     4    21    34    57   167    1    56
## U[17]     6   13     0     1     3     7    36    1    72
## U[18]     1    3     0     0     0     0     6    1   190

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