Anders Nielsen AD Model-Builder

  • Published on
    24-May-2015

  • View
    651

  • Download
    6

Embed Size (px)

Transcript

<ul><li> 1. Introduction to AD Model Builder Anders Nielsen an@aqua.dtu.dk </li></ul> <p> 2. What is AD Model Builder Tool for development and optimization of nonlinear models Structured template for C++ programming Support library containing: A quasi-Newton minimizer aided by automatic dierentiation Data objects (number, vector, matrix, 3darray, ragged arrays, strings, ...) Model parameters (unbounded, bounded, xed, summing to zero, vectors of, matrix of, ...) A simple way to set up optimization in phases Standard ways to quantify uncertainty (Hessian based delta method, prole like- lihood, MCMC sampling) Tools for random eects (AD aided Laplace approximation, sparse ma- trix, importance sampling, ...) Lots of helper functions (gammaln, choleski decomp, inv, det, eigenvalues, RNG, ... ) 3. What is it used for? Not enough Our web-site lists (at my last count): 110 peer reviewed publications based on AD Model Builder applications 18 Theses and Dissertations Countless reports and sh stock assessments Those are only the users who remembered to report back Models in sheries science are typically: Non-standard Non-linear High dimensional Often they also contain random eects They should preferably run in minutes Dave Fournier receiving the AFS Ricker award 4. Quick example Assume that these 15 numbers follow a negative binomial distribution: # Number of observations 15 # Observations 13 5 28 28 15 4 13 4 10 17 11 13 12 17 3 Estimate the two unknown parameters. Entire AD Model Builder Program: DATA_SECTION init_int N init_vector X(1,N); PARAMETER_SECTION init_number logsize; init_bounded_number p(0,1); sdreport_number size; objective_function_value nll; PROCEDURE_SECTION size=exp(logsize); nll=-sum(gammln(X+size))+N*gammln(size)+ sum(gammln(X+1.0))-N*size*log(p)-sum(X)*log(1.0-p); Compile: .tpl makeadm .cpp g++ binary index name value std dev 1 logsize 1.3017e+00 4.7101e-01 2 p 2.2218e-01 8.5571e-02 3 size 3.6754e+00 1.7312e+00 5. A sheries catch-at-age model Data is the yearly catch in 7 age classes and 45 years Cay, and a yearly index of shing eort ey The model has 107 model parameters to be estimated (small for an assessment model) The model is non-linear In AD Model Builder that takes 0.3 seconds to optimize and compute and write all output 6. Random eects no problem DATA_SECTION init_int N init_vector Y(1,N) PARAMETER_SECTION init_number logr0 init_number logtheta init_bounded_number logK(4.6,7.6) init_number logQ init_number logR random_effects_vector X(1,N); sdreport_number r0 sdreport_number theta sdreport_number K sdreport_number Q sdreport_number R objective_function_value jnll PROCEDURE_SECTION for(int i=2; i</p>