Package: ctsmTMB 1.1.1

Phillip Vetter

ctsmTMB: Continuous Time Stochastic Modelling using Template Model Builder

Perform state and parameter inference, and forecasting, in stochastic state-space systems using the 'ctsmTMB' R6 class. This class provides a user-friendly interface for working with stochastic state space models. Inference is based on maximum likelihood estimation, with derivatives efficiently computed through automatic differentiation enabled by the 'TMB'/'RTMB' packages (Kristensen et al., 2016) <doi:10.18637/jss.v070.i05>. The available inference methods include Kalman filters, in addition to a Laplace approximation-based smoothing method. For further details of these methods refer to the documentation of the 'CTSMR' package <https://ctsm.info/ctsmr-reference.pdf> and Thygesen (2025) <doi:10.48550/arXiv.2503.21358>. Forecasting capabilities include moment predictions and stochastic path simulations implemented in 'C++' using 'Rcpp' (Eddelbuettel et al., 2018) <doi:10.1080/00031305.2017.1375990> for computational efficiency.

Authors:Phillip Vetter [aut, cre, cph], Jan Møller [ctb], Uffe Thygesen [ctb], Peder Bacher [ctb], Henrik Madsen [ctb]

ctsmTMB_1.1.1.tar.gz
ctsmTMB_1.1.1.zip(r-4.7-x86_64)ctsmTMB_1.1.1.zip(r-4.7-arm64)ctsmTMB_1.1.1.zip(r-4.6-x86_64)ctsmTMB_1.1.1.zip(r-4.6-arm64)ctsmTMB_1.1.1.zip(r-4.5-x86_64)
ctsmTMB_1.1.1.tgz(r-4.6-x86_64)ctsmTMB_1.1.1.tgz(r-4.6-arm64)ctsmTMB_1.1.1.tgz(r-4.5-x86_64)ctsmTMB_1.1.1.tgz(r-4.5-arm64)
ctsmTMB_1.1.1.tar.gz(r-4.7-arm64)ctsmTMB_1.1.1.tar.gz(r-4.7-x86_64)ctsmTMB_1.1.1.tar.gz(r-4.6-arm64)ctsmTMB_1.1.1.tar.gz(r-4.6-x86_64)
ctsmTMB_1.1.1.tgz(r-4.6-emscripten)
manual.pdf |manual.html✨
DESCRIPTION |NEWS
card.svg |card.png
ctsmTMB/json (API)

# Install 'ctsmTMB' in R:
install.packages('ctsmTMB', repos = c('https://phillipbvetter.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/phillipbvetter/ctsmtmb/issues

Uses libs:
  • c++– GNU Standard C++ Library v3
Datasets:
  • EstimateReferenceData - A list of outputs generated from calling the 'estimate' method with the state reconstruction methods 'ekf', 'lkf', 'ukf', 'laplace' and 'laplace.thygesen'.
  • Ornstein - Sample from a simulated Ornstein-Uhlenbeck process with time-dependent mean
  • Ornstein2D - Sample from a simulated two-state Ornstein-Uhlenbeck process
  • OutputReferenceData - A list of outputs generated from calling the 'filter', 'predict' and 'simulate' method on the Ornstein2D data.

On CRAN:

Conda:

cpp

7.59 score 7 stars 84 scripts 373 downloads 4 exports 30 dependencies

Last updated from:9bc79018e7. Checks:13 NOTE, 2 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-devel-arm64NOTE200
linux-devel-x86_64NOTE237
source / vignettesOK426
linux-release-arm64NOTE317
linux-release-x86_64NOTE349
macos-release-arm64NOTE239
macos-release-x86_64NOTE508
macos-oldrel-arm64NOTE228
macos-oldrel-x86_64NOTE303
windows-devel-arm64NOTE336
windows-devel-x86_64NOTE291
windows-release-arm64NOTE327
windows-release-x86_64NOTE535
windows-oldrel-x86_64NOTE274
wasm-releaseOK255

Exports:create.Ornstein1D.modelcreate.Ornstein2D.modelctsmTMBnewModel

Dependencies:clicpp11Derivfarverggplot2gluegtableisobandlabelinglatticelifecyclemagrittrMASSMatrixpatchworkR6RColorBrewerRcppRcppEigenrlangRTMBS7scalesstringistringrTMBvctrsviridisLitewithrzigg

Moment Predictions
Introduction | Notation | Stochastic State Space System | Observations and Likelihood | What is a "Prediction"? | Moment Differential Equations | Algorithm | Example | Create Model | Create Data using Simulate | Predict | Output | Long prediction horizons | Forecast Evaluation

Last update: 2026-10-20
Started: 2024-07-02

Stochastic Simulations
Introduction | Notation | Stochastic State Space System | Observations and Likelihood | What is a "Simulation"? | Algorithm \label | Example | Create Model | Create Data | Simulate | Output | Estimating with the Simulated Observations | Many Simulations | Increasing Process Noise | Distribution Plot | Method Arguments | pars | method | ode.solver | ode.timestep | k.ahead | return.k.ahead | sim.timestep | n.sims | initial.state | estimate.initial.state | silent

Last update: 2026-10-20
Started: 2024-09-10

Unscented Kalman Filter using Euler-Maruyama
Notation | General Idea | Setup | Details

Last update: 2026-10-20
Started: 2026-10-20

Getting Started
Initialising | Add system equations | Add observation equations | Add observation variances | Add inputs | Add parameters | Set initial state and covariance | Generate Data | Perform estimation | Inspecting the fit object | Parameter estimates | State estimates | Residual analysis | Profiling the likelihood | Extra: Algebraic equations

Last update: 2026-09-28
Started: 2024-07-02

Parameter Estimation
Introduction | Notation | Stochastic State Space System | Observations and Likelihood | What is an "Estimation"? | Moment Differential Equations | Example | Method Arguments | method | ode.solver | ode.timestep | loss / loss_c | use_hessian | laplace.residuals | unconstrainted.optim | estimate.initial.state | control | silent

Last update: 2026-07-10
Started: 2024-07-02

Extracting the Likelihood Function and Changing Optimizer
Simulate from the Ornstein-Uhlenbeck process | Construct model object | Estimation | Extract function handlers | Extract parameter lower/upper bounds | Optimize manually using stats::optim | Compare results between the two optimizers

Last update: 2025-08-11
Started: 2025-01-24

AddObs - Details
Adding observation equations | Adding observation variances | Multiple observation equations

Last update: 2025-04-01
Started: 2024-07-02

Extended Kalman Filter

Last update: 2025-04-01
Started: 2024-09-10

Linear Kalman Filter

Last update: 2025-04-01
Started: 2025-04-01

Unscented Kalman Filter

Last update: 2025-04-01
Started: 2024-09-10

Laplace Approximation

Last update: 2025-01-23
Started: 2024-09-10