Network


Latest external collaboration on country level. Dive into details by clicking on the dots.

Hotspot


Dive into the research topics where Casper Willestofte Berg is active.

Publication


Featured researches published by Casper Willestofte Berg.


Journal of Statistical Software | 2016

TMB: Automatic differentiation and laplace approximation

Kasper Kristensen; Anders Henry Nielsen; Casper Willestofte Berg; Hans J. Skaug; Brad Bell

TMB is an open source R package that enables quick implementation of complex nonlinear random effect (latent variable) models in a manner similar to the established AD Model Builder package (ADMB, admb-project.org). In addition, it offers easy access to parallel computations. The user defines the joint likelihood for the data and the random effects as a C++ template function, while all the other operations are done in R; e.g., reading in the data. The package evaluates and maximizes the Laplace approximation of the marginal likelihood where the random effects are automatically integrated out. This approximation, and its derivatives, are obtained using automatic differentiation (up to order three) of the joint likelihood. The computations are designed to be fast for problems with many random effects (~10^6) and parameters (~10^3). Computation times using ADMB and TMB are compared on a suite of examples ranging from simple models to large spatial models where the random effects are a Gaussian random field. Speedups ranging from 1.5 to about 100 are obtained with increasing gains for large problems. The package and examples are available at this http URL


Methods in Ecology and Evolution | 2013

Strategies for fitting nonlinear ecological models in R, AD Model Builder, and BUGS

Benjamin M. Bolker; Beth Gardner; Mark N. Maunder; Casper Willestofte Berg; Mollie E. Brooks; Liza S. Comita; Elizabeth E. Crone; Sarah Cubaynes; Trevor Davies; Perry de Valpine; Jessica Ford; Olivier Gimenez; Marc Kéry; Eun Jung Kim; Cleridy E. Lennert-Cody; Arni Magnusson; Steve Martell; John C. Nash; Anders Paarup Nielsen; Jim Regetz; Hans J. Skaug; Elise F. Zipkin

1. Ecologists often use nonlinear fitting techniques to estimate the parameters of complex ecological models, with attendant frustration. This paper compares three open-source model fitting tools and discusses general strategies for defining and fitting models. 2. R is convenient and (relatively) easy to learn, AD Model Builder is fast and robust but comes with a steep learning curve, while BUGS provides the greatest flexibility at the price of speed. 3. Our model-fitting suggestions range from general cultural advice (where possible, use the tools and models that are most common in your subfield) to specific suggestions about how to change the mathematical description of models to make them more amenable to parameter estimation. 4. A companion web site (https://groups.nceas.ucsb.edu/nonlinear-modeling/projects) presents detailed examples of application of the three tools to a variety of typical ecological estimation problems; each example links both to a detailed project report and to full source code and data.


bioRxiv | 2017

Modeling Zero-Inflated Count Data With glmmTMB

Mollie E. Brooks; Kasper Kristensen; Koen J. van Benthem; Arni Magnusson; Casper Willestofte Berg; Anders Paarup Nielsen; Hans J. Skaug; Martin Maechler; Benjamin M. Bolker

Ecological phenomena are often measured in the form of count data. These data can be analyzed using generalized linear mixed models (GLMMs) when observations are correlated in ways that require random effects. However, count data are often zero-inflated, containing more zeros than would be expected from the standard error distributions used in GLMMs, e.g., parasite counts may be exactly zero for hosts with effective immune defenses but vary according to a negative binomial distribution for non-resistant hosts. We present a new R package, glmmTMB, that increases the range of models that can easily be fitted to count data using maximum likelihood estimation. The interface was developed to be familiar to users of the lme4 R package, a common tool for fitting GLMMs. To maximize speed and flexibility, estimation is done using Template Model Builder (TMB), utilizing automatic differentiation to estimate model gradients and the Laplace approximation for handling random effects. We demonstrate glmmTMB and compare it to other available methods using two ecological case studies. In general, glmmTMB is more flexible than other packages available for estimating zero-inflated models via maximum likelihood estimation and is faster than packages that use Markov chain Monte Carlo sampling for estimation; it is also more flexible for zero-inflated modelling than INLA, but speed comparisons vary with model and data structure. Our package can be used to fit GLMs and GLMMs with or without zero-inflation as well as hurdle models. By allowing ecologists to quickly estimate a wide variety of models using a single package, glmmTMB makes it easier to find appropriate models and test hypotheses to describe ecological processes.


Environmental and Ecological Statistics | 2017

Validation of ecological state space models using the Laplace approximation

Uffe Høgsbro Thygesen; Casper Willestofte Berg; Kasper Kristensen; Anders Paarup Nielsen

Many statistical models in ecology follow the state space paradigm. For such models, the important step of model validation rarely receives as much attention as estimation or hypothesis testing, perhaps due to lack of available algorithms and software. Model validation is often based on a naive adaptation of Pearson residuals, i.e. the difference between observations and posterior means, even if this approach is flawed. Here, we consider validation of state space models through one-step prediction errors, and discuss principles and practicalities arising when the model has been fitted with a tool for estimation in general mixed effects models. Implementing one-step predictions in the R package Template Model Builder, we demonstrate that it is possible to perform model validation with little effort, even if the ecological model is multivariate, has non-linear dynamics, and whether observations are continuous or discrete. With both simulated data, and a real data set related to geolocation of seals, we demonstrate both the potential and the limitations of the techniques. Our results fill a need for convenient methods for validating a state space model, or alternatively, rejecting it while indicating useful directions in which the model could be improved.


Fisheries Research | 2014

Estimation of time-varying selectivity in stock assessments using state-space models

Anders Paarup Nielsen; Casper Willestofte Berg


Ecological Modelling | 2011

Estimation methods for nonlinear state-space models in ecology

Martin Wæver Pedersen; Casper Willestofte Berg; Uffe Høgsbro Thygesen; Anders Paarup Nielsen; Henrik Madsen


Fisheries Research | 2014

Evaluation of alternative age-based methods for estimating relative abundance from survey data in relation to assessment models

Casper Willestofte Berg; Anders Paarup Nielsen; Kasper Kristensen


Fisheries Research | 2012

Spatial age-length key modelling using continuation ratio logits

Casper Willestofte Berg; Kasper Kristensen


R Journal | 2017

glmmTMB balances speed and flexibility among packages for zero-inflated generalized linear mixed modeling

Mollie E. Brooks; Kasper Kristensen; Koen J. van Benthem; Arni Magnusson; Casper Willestofte Berg; Anders Paarup Nielsen; Hans J. Skaug; Martin Mächler; Benjamin M. Bolker


Ices Journal of Marine Science | 2016

Accounting for correlated observations in an age-based state-space stock assessment model

Casper Willestofte Berg; Anders Henry Nielsen

Collaboration


Dive into the Casper Willestofte Berg's collaboration.

Top Co-Authors

Avatar

Anders Paarup Nielsen

Technical University of Denmark

View shared research outputs
Top Co-Authors

Avatar

Kasper Kristensen

Technical University of Denmark

View shared research outputs
Top Co-Authors

Avatar

Uffe Høgsbro Thygesen

Technical University of Denmark

View shared research outputs
Top Co-Authors

Avatar

Anders Henry Nielsen

Technical University of Denmark

View shared research outputs
Top Co-Authors

Avatar
Top Co-Authors

Avatar
Top Co-Authors

Avatar

Henrik Mosegaard

Technical University of Denmark

View shared research outputs
Top Co-Authors

Avatar

Margit Eero

Technical University of Denmark

View shared research outputs
Top Co-Authors

Avatar

Martin Wæver Pedersen

Technical University of Denmark

View shared research outputs
Top Co-Authors

Avatar
Researchain Logo
Decentralizing Knowledge