The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.

Interpolating run early and late

Carl James Schwarz

2021-10-24

1 Introduction

In some studies, harvest (recovery strata) start after the run has started and terminate prior to the run ending. For example, consider the following recovery matrix where releases and recoveries have been stratified on a weekly basis:

##      Tagging SW22 SW23 SW24 SW25 SW26 SW27 SW28 SW29 SW30 SW31 SW32 SW33 SW34 SW35 SW36 SW37 Applied
## 1       SW22    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0      10
## 2       SW23    0    0    0    1    0    0    0    0    0    0    0    0    0    0    0    0     100
## 3       SW24    0    0    0   51    2    0    0    0    0    0    0    0    0    0    0    0     525
## 4       SW25    0    0    0   10   45    0    0    0    0    0    0    0    0    0    0    0     403
## 5       SW26    0    0    0    0  169   64    9    0    0    0    0    0    0    0    0    0     849
## 6       SW27    0    0    0    0    0  139   41    5    0    0    0    0    0    0    0    0     742
## 7       SW28    0    0    0    0    0    0  155   31    3    1    0    0    0    0    0    0     675
## 8       SW29    0    0    0    0    0    0    0  266   32    5    0    0    0    0    0    0     916
## 9       SW30    0    0    0    0    0    0    0    0   33   49    3    0    0    0    0    0     371
## 10      SW31    0    0    0    0    0    0    0    0    0   33   36    0    0    0    0    0     296
## 11      SW32    0    0    0    0    0    0    0    0    0    0   39    8    0    0    0    0     234
## 12      SW33    0    0    0    0    0    0    0    0    0    0    0    1    0    0    0    0      39
## 13      SW34    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0      97
## 14      SW35    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0      61
## 15      SW36    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0      26
## 16      SW37    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0       3
## 17 CatchComm    0    0    0 1869 5394 5131 5668 6733 1780 1828 2493  157    0    0    0    0      NA

The bottom line is the total recoveries (tagged and untagged) from a commercial harvest. In this case, the commercial harvest did not start until statistical week SW25 and ended in SW33 but the run started earlier and ended later than the commercial harvest.

1.1 Fit with the current data.

We now fit the BTSPAS model using the current data

## 
## 
## *** Start of call to JAGS 
## Working directory:  /Users/cschwarz/Dropbox/SPAS-Bayesian/BTSPAS/vignettes 
## Initial seed for JAGS set to: 308093 
## Random number seed for chain  895595 
## Random number seed for chain  624580 
## Random number seed for chain  439377 
## Compiling model graph
##    Resolving undeclared variables
##    Allocating nodes
## Graph information:
##    Observed stochastic nodes: 32
##    Unobserved stochastic nodes: 96
##    Total graph size: 897
## 
## Initializing model
## 
## 
  |                                                        
  |                                                  |   0%
  |                                                        
  |++                                                |   4%
  |                                                        
  |++++                                              |   8%
  |                                                        
  |++++++                                            |  12%
  |                                                        
  |++++++++                                          |  16%
  |                                                        
  |++++++++++                                        |  20%
  |                                                        
  |++++++++++++                                      |  24%
  |                                                        
  |++++++++++++++                                    |  28%
  |                                                        
  |++++++++++++++++                                  |  32%
  |                                                        
  |++++++++++++++++++                                |  36%
  |                                                        
  |++++++++++++++++++++                              |  40%
  |                                                        
  |++++++++++++++++++++++                            |  44%
  |                                                        
  |++++++++++++++++++++++++                          |  48%
  |                                                        
  |++++++++++++++++++++++++++                        |  52%
  |                                                        
  |++++++++++++++++++++++++++++                      |  56%
  |                                                        
  |++++++++++++++++++++++++++++++                    |  60%
  |                                                        
  |++++++++++++++++++++++++++++++++                  |  64%
  |                                                        
  |++++++++++++++++++++++++++++++++++                |  68%
  |                                                        
  |++++++++++++++++++++++++++++++++++++              |  72%
  |                                                        
  |++++++++++++++++++++++++++++++++++++++            |  76%
  |                                                        
  |++++++++++++++++++++++++++++++++++++++++          |  80%
  |                                                        
  |++++++++++++++++++++++++++++++++++++++++++        |  84%
  |                                                        
  |++++++++++++++++++++++++++++++++++++++++++++      |  88%
  |                                                        
  |++++++++++++++++++++++++++++++++++++++++++++++    |  92%
  |                                                        
  |++++++++++++++++++++++++++++++++++++++++++++++++  |  96%
  |                                                        
  |++++++++++++++++++++++++++++++++++++++++++++++++++| 100%
## 
  |                                                        
  |                                                  |   0%
  |                                                        
  |**                                                |   4%
  |                                                        
  |****                                              |   8%
  |                                                        
  |******                                            |  12%
  |                                                        
  |********                                          |  16%
  |                                                        
  |**********                                        |  20%
  |                                                        
  |************                                      |  24%
  |                                                        
  |**************                                    |  28%
  |                                                        
  |****************                                  |  32%
  |                                                        
  |******************                                |  36%
  |                                                        
  |********************                              |  40%
  |                                                        
  |**********************                            |  44%
  |                                                        
  |************************                          |  48%
  |                                                        
  |**************************                        |  52%
  |                                                        
  |****************************                      |  56%
  |                                                        
  |******************************                    |  60%
  |                                                        
  |********************************                  |  64%
  |                                                        
  |**********************************                |  68%
  |                                                        
  |************************************              |  72%
  |                                                        
  |**************************************            |  76%
  |                                                        
  |****************************************          |  80%
  |                                                        
  |******************************************        |  84%
  |                                                        
  |********************************************      |  88%
  |                                                        
  |**********************************************    |  92%
  |                                                        
  |************************************************  |  96%
  |                                                        
  |**************************************************| 100%
## 
## 
## *** Finished JAGS ***
## [1] TRUE
## [1] TRUE
## [1] TRUE
## [1] TRUE
## [1] TRUE
## [1] TRUE
## [1] TRUE
## [1] TRUE
## [1] TRUE

On the surface, the fit looks fine:

but the spline remains very large in the first 3 weeks leading to unrealistic estimates of the run in the first 3 weeks and an unrealistic estimate of the total run:

##         mean    sd   2.5%  97.5%
## Ntot  207788 84023 133226 387826
## U[1]   29243 55082    102 127046
## U[2]   23161 22111    977  80308
## U[3]   21366 13700   4497  53247
## U[4]   19260  2938  13932  25432
## U[5]   18487  1541  15590  21598
## U[6]   20061  1535  17200  23236
## U[7]   19892  1399  17336  22831
## U[8]   16975  1279  14514  19592
## U[9]   10003  1745   6604  13512
## U[10]   7906  1064   5776  10040
## U[11]   6942  1400   4538  10004
## U[12]   3385  1111   1716   5980
## U[13]   2492  1724    474   6692
## U[14]   1587  1614     72   5401
## U[15]   1012  1400      5   4423
## U[16]    669  1460      0   3672
## Utot  202441 84023 127879 382479

The problem is that without a commercial catch in the first 3 and last 3 weeks, there is no information about the probability of capture for those weeks and BTSPAS simply interpolates the spline from the middle of the data to the first 3 and last 3 weeks. The interpolation for the last 3 weeks isn’t too bad – the spline is already on a downwards trend and so this is continued. However, the interpolation back for the first 3 weeks is not very realistic

1.2 Forcing the run curve to zero.

It is possible to “force” BTSPAS to interpolate the first 3 and last 3 weeks down to zero by adding ``fake’’ data. In particular, we pretend that in the first 3 and last 3 weeks, that a commercial catch of 1 fish occurred and it was tagged. You also need to ensure that enough fish were tagged and released to accommodate the fake data.

The revised recovery matrix is:

##      Tagging SW22 SW23 SW24 SW25 SW26 SW27 SW28 SW29 SW30 SW31 SW32 SW33 SW34 SW35 SW36 SW37 Applied
## 1       SW22    1    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0      10
## 2       SW23    0    1    0    1    0    0    0    0    0    0    0    0    0    0    0    0     100
## 3       SW24    0    0    1   51    2    0    0    0    0    0    0    0    0    0    0    0     525
## 4       SW25    0    0    0   10   45    0    0    0    0    0    0    0    0    0    0    0     403
## 5       SW26    0    0    0    0  169   64    9    0    0    0    0    0    0    0    0    0     849
## 6       SW27    0    0    0    0    0  139   41    5    0    0    0    0    0    0    0    0     742
## 7       SW28    0    0    0    0    0    0  155   31    3    1    0    0    0    0    0    0     675
## 8       SW29    0    0    0    0    0    0    0  266   32    5    0    0    0    0    0    0     916
## 9       SW30    0    0    0    0    0    0    0    0   33   49    3    0    0    0    0    0     371
## 10      SW31    0    0    0    0    0    0    0    0    0   33   36    0    0    0    0    0     296
## 11      SW32    0    0    0    0    0    0    0    0    0    0   39    8    0    0    0    0     234
## 12      SW33    0    0    0    0    0    0    0    0    0    0    0    1    0    0    0    0      39
## 13      SW34    0    0    0    0    0    0    0    0    0    0    0    0    1    0    0    0      97
## 14      SW35    0    0    0    0    0    0    0    0    0    0    0    0    0    1    0    0      61
## 15      SW36    0    0    0    0    0    0    0    0    0    0    0    0    0    0    1    0      26
## 16      SW37    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    1       3
## 17 CatchComm    1    1    1 1869 5394 5131 5668 6733 1780 1828 2493  157    1    1    1    1      NA

Notice how “fake” recoveries were added to the diagonal entries for the first and final weeks of the data including “fake” harvest.

Because the fake data values are very small, it has little impact on the total run size, but a recovery of 1 tagged fish in a commercial harvest of 1 fish is not consistent with a very large run size and so this forces the run curve down at these points as seen in the revised fit:

## 
## 
## *** Start of call to JAGS 
## Working directory:  /Users/cschwarz/Dropbox/SPAS-Bayesian/BTSPAS/vignettes 
## Initial seed for JAGS set to: 388835 
## Random number seed for chain  120932 
## Random number seed for chain  79161 
## Random number seed for chain  202631 
## Compiling model graph
##    Resolving undeclared variables
##    Allocating nodes
## Graph information:
##    Observed stochastic nodes: 32
##    Unobserved stochastic nodes: 96
##    Total graph size: 897
## 
## Initializing model
## 
## 
  |                                                        
  |                                                  |   0%
  |                                                        
  |++                                                |   4%
  |                                                        
  |++++                                              |   8%
  |                                                        
  |++++++                                            |  12%
  |                                                        
  |++++++++                                          |  16%
  |                                                        
  |++++++++++                                        |  20%
  |                                                        
  |++++++++++++                                      |  24%
  |                                                        
  |++++++++++++++                                    |  28%
  |                                                        
  |++++++++++++++++                                  |  32%
  |                                                        
  |++++++++++++++++++                                |  36%
  |                                                        
  |++++++++++++++++++++                              |  40%
  |                                                        
  |++++++++++++++++++++++                            |  44%
  |                                                        
  |++++++++++++++++++++++++                          |  48%
  |                                                        
  |++++++++++++++++++++++++++                        |  52%
  |                                                        
  |++++++++++++++++++++++++++++                      |  56%
  |                                                        
  |++++++++++++++++++++++++++++++                    |  60%
  |                                                        
  |++++++++++++++++++++++++++++++++                  |  64%
  |                                                        
  |++++++++++++++++++++++++++++++++++                |  68%
  |                                                        
  |++++++++++++++++++++++++++++++++++++              |  72%
  |                                                        
  |++++++++++++++++++++++++++++++++++++++            |  76%
  |                                                        
  |++++++++++++++++++++++++++++++++++++++++          |  80%
  |                                                        
  |++++++++++++++++++++++++++++++++++++++++++        |  84%
  |                                                        
  |++++++++++++++++++++++++++++++++++++++++++++      |  88%
  |                                                        
  |++++++++++++++++++++++++++++++++++++++++++++++    |  92%
  |                                                        
  |++++++++++++++++++++++++++++++++++++++++++++++++  |  96%
  |                                                        
  |++++++++++++++++++++++++++++++++++++++++++++++++++| 100%
## 
  |                                                        
  |                                                  |   0%
  |                                                        
  |**                                                |   4%
  |                                                        
  |****                                              |   8%
  |                                                        
  |******                                            |  12%
  |                                                        
  |********                                          |  16%
  |                                                        
  |**********                                        |  20%
  |                                                        
  |************                                      |  24%
  |                                                        
  |**************                                    |  28%
  |                                                        
  |****************                                  |  32%
  |                                                        
  |******************                                |  36%
  |                                                        
  |********************                              |  40%
  |                                                        
  |**********************                            |  44%
  |                                                        
  |************************                          |  48%
  |                                                        
  |**************************                        |  52%
  |                                                        
  |****************************                      |  56%
  |                                                        
  |******************************                    |  60%
  |                                                        
  |********************************                  |  64%
  |                                                        
  |**********************************                |  68%
  |                                                        
  |************************************              |  72%
  |                                                        
  |**************************************            |  76%
  |                                                        
  |****************************************          |  80%
  |                                                        
  |******************************************        |  84%
  |                                                        
  |********************************************      |  88%
  |                                                        
  |**********************************************    |  92%
  |                                                        
  |************************************************  |  96%
  |                                                        
  |**************************************************| 100%
## 
## 
## *** Finished JAGS ***
## [1] TRUE
## [1] TRUE
## [1] TRUE
## [1] TRUE
## [1] TRUE
## [1] TRUE
## [1] TRUE
## [1] TRUE
## [1] TRUE

Notice that in the revised fit, the run curve is forced to 0 at the start and end of the study:

The estimates of total run size and the weekly estimates of the runsize are also more sensible:

##         mean   sd   2.5%  97.5%
## Ntot  126876 3935 119430 134994
## U[1]       0    2      0      2
## U[2]      11   36      0     89
## U[3]     497  623     11   2218
## U[4]   16687 2867  11435  22653
## U[5]   18806 1725  15577  22271
## U[6]   20237 1644  17183  23703
## U[7]   20166 1490  17522  23334
## U[8]   17462 1362  14795  20150
## U[9]    9348 1941   5751  13505
## U[10]   7536 1239   5123   9970
## U[11]   8845 1705   5656  12324
## U[12]   1831  652    854   3317
## U[13]     97  130      3    435
## U[14]      4   13      0     36
## U[15]      0    2      0      2
## U[16]      0    1      0      0
## Utot  121529 3935 114083 129647

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.