FIMS software platform exploratory analysis

Andrea Havron

7/20/2021

Introduction

The Fisheries Integrated Management Systems aims to offer a system of modular, maintainable, and extensible models for next generation stock assessments. The choice of software platform used to develop FIMS will heavily influence the success of the initiative. While a thorough review of FIMS requirements is currently underway, a concurrent exploration of candidate software platforms will provide insight that will guide final decisions once software requirements have been established.

This project aims to produce a comprehensive review of available statistical computing platforms and summarize their suitability with respect to FIMS. The cross-comparison study will focus on state-space and explicit spatio-temporal modeling. Models will be developed and implemented across the following software platforms: TMB, C++, Julia, Greta tensorflow, and Stan. Inference pathways for both frequentist and Bayesian inference will be outlined for each platform when applicable. Under consideration will be performance, speed, the usability of the software with respect to both the user and developer, and software features that meet FIMS requirements under consideration.

Models

The state-space comparison looks at a logistic growth model:

\[\begin{align} \eta_{t} &= u_{t-1} + ru_{t-1}(1-u_{t-1}/K) \\ u_{t} &\sim LN(log(\eta_{t}),\sigma_{proc}) \\ y_{t} &\sim LN(log(u_{t}), \sigma_{obs}) \end{align}\],

where \(r\) represents the growth rate and \(K\) represents the density-dependent carrying capacity.

Software Platforms

TMB/R

Fast random effects, reliance on small community of developers

Julia Fast, Code written and executed in single language, still in infancy (may be bugs in base code, small community of developers)

C++/Rcpp Examples: r4MAS, CASAL, GADGET, MultifanCL

Stan HMC sampler, Laplace approximation using the adjoint method, variational Bayes

Greta Machine learning approach to Bayesian inference

Project Deliverables

Results

Platform Comparisons

State-Space Gompertz Results

Parameter estimates for state-space gompertz model (n=100)
true tmb tmbstan stanP0 stanP1
\(\theta_{1}\) 2.0 2.151 2.266 2.253 2.191
\(\theta_{2}\) 0.8 0.786 0.775 0.776 0.782
\(\sigma_{proc}\) 0.1 0.193 0.201 0.201 0.065
\(\sigma_{obs}\) 0.5 0.705 0.708 0.708 0.745
Standard error estimates for state-space gompertz model (n=100)
tmb tmbstan stanP0 stanP1
\(\theta_{1}\) 2.151 0.012 0.370 0.315
\(\theta_{2}\) 0.786 0.001 0.038 0.032
\(\sigma_{proc}\) 0.079 0.030 0.368 1.194
\(\sigma_{obs}\) 0.062 0.003 0.090 0.092
Run times for state-space gompertz model (n=100)
time..min.
tmb 0.001
tmbstan 0.972
stanP0 1.386
stanP1 2.283

State-Space logistic growth results

Parameter estimates for state-space logistic model (n=100)
true tmb tmbstan stanP0 stanP1
r 0.200 0.2124133 0.2093303 0.2072028 0.2081566
K 100.000 104.9323592 105.2542708 105.9495336 104.9503777
\(\sigma_{proc}\) 0.010 0.0817817 0.0917259 0.0905077 0.0976050
\(\sigma_{obs}\) 0.001 0.0406975 0.0128433 0.0262478 0.0031561
Standard error estimates for state-space logistic model (n=100)
tmb tmbstan stanP0 stanP1
r 0.027 0.012 0.029 0.031
K 4.704 0.002 6.009 5.837
\(\sigma_{proc}\) 0.012 0.010 0.011 0.008
\(\sigma_{obs}\) 0.015 0.249 0.016 0.005
Run times for state-space logistic model (n=100)
time..min.
tmb 0.002
tmbstan 0.501
stanP0 1.071
stanP1 0.393

Benchmark results for logistic growth model

## Warning: Removed 14 row(s) containing missing values (geom_path).

Inference Pathways

TMB

  1. Frequentist: -> fn() and gr() passed to nlminb in R -> quasi-Newton optimization routine (Fox, Hall, and Schryer, 1978; Fox, 1997)
    • fn(): inner optimization step finds optimum random effects values; Laplace approximation calculates the marginal likelihood after integrating out random effects
    • gr(): Gradient functions are determined using forward/reverse automatic differentiation from cppAD and tinyAD
  2. Bayesian -> fn() and gr() passed to Stan -> HMC algorithm (using tmbStan)

C++

  1. Frequentist
  2. Bayesian -> fn() and gr() passed to Stan -> HMC algorithm (using tmbStan)
    • -> fn() and gr() passed to Stan -> HMC algorithm (using tmbStan)
    • ? -> fn() passed to Stan -> Laplace/HMC ?
    • ? -> pass to python and tensorflow ?
    • Framework for acquiring gradients?

Performance results (eg. stability of source code) * Software platform pros and cons * Ease of use summary * Summary of input/output procedures