ebook img

Using R for Modelling and Quantitative Methods in Fisheries PDF

353 Pages·10.021 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Using R for Modelling and Quantitative Methods in Fisheries

Using R for Modelling and Quantitative Methods in Fisheries Chapman & Hall/CRC The R Series Series Editors John M. Chambers, Department of Sta(cid:127)s(cid:127)cs, Stanford University, California, USA Torsten Hothorn, Division of Biosta(cid:127)s(cid:127)cs,University of Zurich,Switzerland Duncan Temple Lang, Department of Sta(cid:127)s(cid:127)cs,University of California, Davis, USA Hadley Wickham, RStudio, Boston, Massachuse!s, USA Recently Published Titles Sta!s!cal Compu!ng with R, Second Edi!on Maria L. Rizzo Geocomputa!on with R Robin Lovelace, Jakub Nowosad, Jannes Muenchow Advanced R, Second Edi!on Hadley Wickham Dose Response Analysis Using R Chris!an Ritz, Signe Marie Jensen, Daniel Gerhard, Jens Carl Streibig Distribu!ons for ModellingLoca!on,Scale,and Shape Using GAMLSS in R Robert A. Rigby, Mikis D. Stasinopoulos, Gillian Z. Heller, Fernanda De Bas!ani Hands-On Machine Learning with R Bradley Boehmke and Brandon Greenwell Sta!s!cal Inference via Data Science A ModernDiveintoR and the Tidyverse Chester Ismay and Albert Y. Kim Reproducible Researchwith R and RStudio, Third Edi!on Christopher Gandrud Interac!ve Web-Based Data Visualiza!on with R, plotly, and shiny Carson Sievert Learn R Pedro J. Aphalo Using R for Modelling and Quan!ta!ve Methods in Fisheries Malcolm Haddon For more informa(cid:127)on about this series, please visit: h!ps://www.crcpress.com/Chapman--HallCRC- The-R-Series/book-series/CRCTHERSER Using R for Modelling and Quantitative Methods in Fisheries Malcolm Haddon CSIRO, Oceans and Atmosphere, Hobart IMAS, University of Tasmania CRCPress Taylor&FrancisGroup 6000BrokenSoundParkwayNW,Suite300 BocaRaton,FL33487-2742 ©2021byTaylor&FrancisGroup,LLC CRCPressisanimprintofTaylor&FrancisGroup,anInformabusiness NoclaimtooriginalU.S.Governmentworks Printedonacid-freepaper InternationalStandardBookNumber-13:978-0-367-46989-4(Hardback) 978-0-367-46988-7(Paperback) Thisbookcontainsinformationobtainedfromauthenticandhighlyregardedsources.Reasonable efforts have been made to publish reliable data and information, but the author and publisher cannotassumeresponsibilityforthevalidityofallmaterialsortheconsequencesoftheiruse.The authorsandpublishershaveattemptedtotracethecopyrightholdersofallmaterialreproduced in this publication and apologize to copyright holders if permission to publish in this form has notbeenobtained.Ifanycopyrightmaterialhasnotbeenacknowledgedpleasewriteandletus knowsowemayrectifyinanyfuturereprint. ExceptaspermittedunderU.S.CopyrightLaw,nopartofthisbookmaybereprinted,reproduced, transmitted, or utilized in any form by any electronic, mechanical, or other means, now known orhereafterinvented,includingphotocopying,microfilming,andrecording,orinanyinformation storageorretrievalsystem,withoutwrittenpermissionfromthepublishers. For permission to photocopy or use material electronically from this work, please access www.copyright.com (http://www.copyright.com/) or contact the Copyright Clearance Center, Inc. (CCC), 222 Rosewood Drive, Danvers, MA 01923, 978-750-8400. CCC is a not-for-profit organizationthatprovideslicensesandregistrationforavarietyofusers.Fororganizationsthat have been granted a photocopy license by the CCC, a separate system of payment has been arranged. Trademark Notice:Productorcorporatenamesmaybetrademarksorregisteredtrademarks, andareusedonlyforidentificationandexplanationwithoutintenttoinfringe. Library of Congress Cataloging-in-Publication Data Names:Haddon,Malcolm,author. Title: Using R for modelling and quantitative methods in fisheries / Malcolm Haddon. Description:BocaRaton:CRCPress,[2021]|Summary:“Thebookhasevolved and adapted from an earlier book by the same author and provides a detailed introduction to analytical methods commonly used by fishery scientists, ecolo- gists,andadvancedstudentsusingtheopensourcesoftwareRasaprogramming tool”--Providedbypublisher. Identifiers: LCCN 2020014277 (print) | LCCN 2020014278 (ebook) | ISBN 9780367469894 (hardback) | ISBN 9780367469887 (paperback) | ISBN 9781003032601(ebook) Subjects: LCSH: Fisheries--Mathematical models. | R (Computer program language) Classification: LCC SH331.5.M48 H343 2021 (print) | LCC SH331.5.M48 (ebook)|DDC333.95/611015118--dc23 LCrecordavailableathttps://lccn.loc.gov/2020014277 LCebookrecordavailableathttps://lccn.loc.gov/2020014278 Visit the Taylor & Francis Web site at http://www.taylorandfrancis.com and the CRC Press Web site at http://www.crcpress.com Contents Preface xi 1 On Modelling 1 1.1 Characteristics of Mathematical Models . . . . . . . . . . . . 1 1.1.1 General . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1.1.2 Model Design or Selection . . . . . . . . . . . . . . . . 1 1.1.3 Constraints Due to the Model Type . . . . . . . . . . 3 1.1.4 Mathematical Models . . . . . . . . . . . . . . . . . . 3 1.1.5 Parameters and Variables . . . . . . . . . . . . . . . . 4 1.2 Mathematical Model Properties . . . . . . . . . . . . . . . . 5 1.2.1 Deterministic vs Stochastic . . . . . . . . . . . . . . . 5 1.2.2 Continuous vs Discrete Models . . . . . . . . . . . . . 6 1.2.3 Descriptive vs Explanatory . . . . . . . . . . . . . . . 7 1.2.4 Testing Explanatory Models . . . . . . . . . . . . . . . 8 1.2.5 Realism vs Generality . . . . . . . . . . . . . . . . . . 9 1.2.6 When Is a Model a Theory? . . . . . . . . . . . . . . . 10 1.3 Concluding Remarks . . . . . . . . . . . . . . . . . . . . . . 11 2 A Non-Introduction to R 13 2.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 2.2 Programming in R . . . . . . . . . . . . . . . . . . . . . . . . 13 2.2.1 Getting Started with R . . . . . . . . . . . . . . . . . 14 2.2.2 R Packages . . . . . . . . . . . . . . . . . . . . . . . . 15 2.2.3 Getting Started with MQMF . . . . . . . . . . . . . 16 2.2.4 Examining Code within Functions . . . . . . . . . . . 17 2.2.5 Using Functions . . . . . . . . . . . . . . . . . . . . . 18 2.2.6 Random Number Generation . . . . . . . . . . . . . . 19 2.2.7 Printing in R . . . . . . . . . . . . . . . . . . . . . . . 21 2.2.8 Plotting in R . . . . . . . . . . . . . . . . . . . . . . . 21 2.2.9 Dealing with Factors . . . . . . . . . . . . . . . . . . . 22 2.2.10 Inputting Data . . . . . . . . . . . . . . . . . . . . . . 24 2.3 Writing Functions . . . . . . . . . . . . . . . . . . . . . . . . 25 2.3.1 Simple Functions . . . . . . . . . . . . . . . . . . . . . 25 2.3.2 Function Input Values . . . . . . . . . . . . . . . . . . 27 2.3.3 R Objects . . . . . . . . . . . . . . . . . . . . . . . . . 28 2.3.4 Scoping of Objects . . . . . . . . . . . . . . . . . . . . 28 v vi Contents 2.3.5 Function Inputs and Outputs . . . . . . . . . . . . . . 29 2.4 Appendix: Less-Traveled Functions . . . . . . . . . . . . . . 33 2.5 Appendix: Additional Learning Resources . . . . . . . . . . . 33 3 Simple Population Models 35 3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 3.1.1 The Discrete Logistic Model. . . . . . . . . . . . . . . 35 3.1.2 Dynamic Behaviour . . . . . . . . . . . . . . . . . . . 37 3.1.3 Finding Boundaries between Behaviours . . . . . . . . 40 3.1.4 Classical Bifurcation Diagram of Chaos . . . . . . . . 42 3.1.5 The Effect of Fishing on Dynamics . . . . . . . . . . . 43 3.1.6 Determinism . . . . . . . . . . . . . . . . . . . . . . . 46 3.2 Age-Structured Modelling Concepts . . . . . . . . . . . . . . 48 3.2.1 Survivorship in a Cohort. . . . . . . . . . . . . . . . . 48 3.2.2 Instantaneous vs Annual Mortality Rates . . . . . . . 49 3.3 Simple Yield per Recruit . . . . . . . . . . . . . . . . . . . . 52 3.3.1 Selectivity in Yield-per-Recruit . . . . . . . . . . . . . 55 3.3.2 The Baranov Catch Equation . . . . . . . . . . . . . . 57 3.3.3 Growth and Weight-at-Age . . . . . . . . . . . . . . . 59 3.4 Full Yield-per-Recruit . . . . . . . . . . . . . . . . . . . . . . 60 3.5 Concluding Remarks . . . . . . . . . . . . . . . . . . . . . . 62 4 Model Parameter Estimation 65 4.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 4.1.1 Optimization . . . . . . . . . . . . . . . . . . . . . . . 66 4.2 Criteria of Best Fit . . . . . . . . . . . . . . . . . . . . . . . 67 4.3 Model Fitting in R . . . . . . . . . . . . . . . . . . . . . . . 69 4.3.1 Model Requirements . . . . . . . . . . . . . . . . . . . 70 4.3.2 A Length-at-Age Example . . . . . . . . . . . . . . . . 71 4.3.3 Alternative Models of Growth . . . . . . . . . . . . . . 72 4.4 Sum of Squared Residual Deviations . . . . . . . . . . . . . . 73 4.4.1 Assumptions of Least-Squares . . . . . . . . . . . . . . 74 4.4.2 Numerical Solutions . . . . . . . . . . . . . . . . . . . 74 4.4.3 Passing Functions as Arguments to Other Functions . 75 4.4.4 Fitting the Models . . . . . . . . . . . . . . . . . . . . 77 4.4.5 Objective Model Selection . . . . . . . . . . . . . . . . 83 4.4.6 The Influence of Residual Error Choice on Model Fit . 84 4.4.7 Remarks on Initial Model Fitting . . . . . . . . . . . . 86 4.5 Maximum Likelihood . . . . . . . . . . . . . . . . . . . . . . 87 4.5.1 Introductory Examples. . . . . . . . . . . . . . . . . . 87 4.6 Likelihoods from the Normal Distribution . . . . . . . . . . . 90 4.6.1 Equivalence with Sum-of-Squares . . . . . . . . . . . . 92 4.6.2 Fitting a Model to Data Using Normal Likelihoods . . 94 4.7 Log-Normal Likelihoods . . . . . . . . . . . . . . . . . . . . . 98 4.7.1 Simplification of Log-Normal Likelihoods . . . . . . . 99 Contents vii 4.7.2 Log-Normal Properties . . . . . . . . . . . . . . . . . . 99 4.7.3 Fitting a Curve Using Log-Normal Likelihoods . . . . 102 4.7.4 Fitting a Dynamic Model Using Log-Normal Errors . 105 4.8 Likelihoods from the Binomial Distribution . . . . . . . . . . 108 4.8.1 An Example Using Binomial Likelihoods . . . . . . . . 109 4.8.2 Open Bay Juvenile Fur Seal Population Size. . . . . . 112 4.8.3 Using Multiple Independent Samples . . . . . . . . . . 114 4.8.4 Analytical Approaches . . . . . . . . . . . . . . . . . . 116 4.9 Other Distributions . . . . . . . . . . . . . . . . . . . . . . . 117 4.10 Likelihoods from the Multinomial Distribution . . . . . . . . 117 4.10.1 Using the Multinomial Distribution. . . . . . . . . . . 119 4.11 Likelihoods from the Gamma Distribution . . . . . . . . . . 125 4.12 Likelihoods from the Beta Distribution . . . . . . . . . . . . 127 4.13 Bayes’ Theorem . . . . . . . . . . . . . . . . . . . . . . . . . 128 4.13.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . 128 4.13.2 Bayesian Methods . . . . . . . . . . . . . . . . . . . . 130 4.13.3 Prior Probabilities . . . . . . . . . . . . . . . . . . . . 131 4.14 Concluding Remarks . . . . . . . . . . . . . . . . . . . . . . 134 5 Static Models 135 5.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . 135 5.2 Productivity Parameters . . . . . . . . . . . . . . . . . . . . 136 5.3 Growth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136 5.3.1 Seasonal Growth Curves . . . . . . . . . . . . . . . . . 137 5.3.2 Fabens Method with Tagging Data . . . . . . . . . . . 142 5.3.3 Fitting Models to Tagging Data . . . . . . . . . . . . 144 5.3.4 A Closer Look at the Fabens Methods . . . . . . . . . 146 5.3.5 Implementation of Non-Constant Variances . . . . . . 148 5.4 Objective Model Selection . . . . . . . . . . . . . . . . . . . 151 5.4.1 Akiake’s Information Criterion . . . . . . . . . . . . . 151 5.4.2 Likelihood Ratio Test . . . . . . . . . . . . . . . . . . 153 5.4.3 Caveats on Likelihood Ratio Tests . . . . . . . . . . . 154 5.5 Remarks on Growth . . . . . . . . . . . . . . . . . . . . . . . 154 5.6 Maturity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155 5.6.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . 155 5.6.2 Alternative Maturity Ogives. . . . . . . . . . . . . . . 157 5.6.3 The Assumption of Symmetry . . . . . . . . . . . . . 161 5.7 Recruitment . . . . . . . . . . . . . . . . . . . . . . . . . . . 165 5.7.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . 165 5.7.2 Properties of “Good” Stock Recruitment Relationships 166 5.7.3 Recruitment Overfishing . . . . . . . . . . . . . . . . . 167 5.7.4 Beverton and Holt Recruitment . . . . . . . . . . . . . 168 5.7.5 Ricker Recruitment. . . . . . . . . . . . . . . . . . . . 169 5.7.6 Deriso’s Generalized Model . . . . . . . . . . . . . . . 171 5.7.7 Re-Parameterized Beverton-Holt Equation . . . . . . . 172 viii Contents 5.7.8 Re-Parameterized Ricker Equation . . . . . . . . . . . 175 5.8 Selectivity . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175 5.8.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . 175 5.8.2 Logistic Selection . . . . . . . . . . . . . . . . . . . . . 176 5.8.3 Dome-Shaped Selection . . . . . . . . . . . . . . . . . 177 5.9 Concluding Remarks for Static Models . . . . . . . . . . . . 180 5.10 Appendix: Derivation of Fabens Transformation . . . . . . . 181 5.11 Appendix: Reparameterization of Beverton-Holt . . . . . . . 182 6 On Uncertainty 185 6.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . 185 6.1.1 Types of Uncertainty. . . . . . . . . . . . . . . . . . . 185 6.1.2 The Example Model . . . . . . . . . . . . . . . . . . . 188 6.2 Bootstrapping . . . . . . . . . . . . . . . . . . . . . . . . . . 191 6.2.1 Empirical Probability Density Distributions . . . . . . 191 6.3 A Simple Bootstrap Example . . . . . . . . . . . . . . . . . . 192 6.4 Bootstrapping Time-Series Data . . . . . . . . . . . . . . . . 195 6.4.1 Parameter Correlation . . . . . . . . . . . . . . . . . . 199 6.5 Asymptotic Errors . . . . . . . . . . . . . . . . . . . . . . . . 200 6.5.1 Uncertainty about the Model Outputs . . . . . . . . . 203 6.5.2 Sampling from a Multivariate Normal Distribution . . 204 6.6 Likelihood Profiles . . . . . . . . . . . . . . . . . . . . . . . . 209 6.6.1 Likelihood Ratio-Based Confidence Intervals. . . . . . 212 6.6.2 -ve Log-Likelihoods or Likelihoods . . . . . . . . . . . 214 6.6.3 Percentile Likelihood Profiles for Model Outputs . . . 216 6.7 Bayesian Posterior Distributions . . . . . . . . . . . . . . . . 219 6.7.1 Generating the Markov Chain . . . . . . . . . . . . . . 221 6.7.2 The Starting Point . . . . . . . . . . . . . . . . . . . . 222 6.7.3 The Burn-In Period . . . . . . . . . . . . . . . . . . . 223 6.7.4 Convergence to the Stationary Distribution . . . . . . 223 6.7.5 The Jumping Distribution . . . . . . . . . . . . . . . . 224 6.7.6 Application of MCMC to the Example . . . . . . . . . 225 6.7.7 Markov Chain Monte Carlo . . . . . . . . . . . . . . . 225 6.7.8 A First Example of an MCMC . . . . . . . . . . . . . 228 6.7.9 Marginal Distributions . . . . . . . . . . . . . . . . . . 235 6.8 The Use of Rcpp . . . . . . . . . . . . . . . . . . . . . . . . . 236 6.8.1 Addressing Vectors and Matrices . . . . . . . . . . . . 239 6.8.2 Replacement for simpspm() . . . . . . . . . . . . . . . 240 6.8.3 Multiple Independent Chains . . . . . . . . . . . . . . 243 6.8.4 Replicates Required to Avoid Serial Correlation . . . . 247 6.9 Concluding Remarks . . . . . . . . . . . . . . . . . . . . . . 251 7 Surplus Production Models 253 7.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . 253 7.1.1 Data Needs . . . . . . . . . . . . . . . . . . . . . . . . 254 Contents ix 7.1.2 The Need for Contrast . . . . . . . . . . . . . . . . . . 254 7.1.3 When Are Catch-Rates Informative? . . . . . . . . . . 255 7.2 Some Equations . . . . . . . . . . . . . . . . . . . . . . . . . 259 7.2.1 Production Functions . . . . . . . . . . . . . . . . . . 261 7.2.2 The Schaefer Model . . . . . . . . . . . . . . . . . . . 263 7.2.3 Sum of Squared Residuals . . . . . . . . . . . . . . . . 264 7.2.4 Estimating Management Statistics . . . . . . . . . . . 265 7.2.5 The Trouble with Equilibria . . . . . . . . . . . . . . . 266 7.3 Model Fitting . . . . . . . . . . . . . . . . . . . . . . . . . . 267 7.3.1 A Possible Workflow for Stock Assessment . . . . . . . 268 7.3.2 Is the Analysis Robust? . . . . . . . . . . . . . . . . . 274 7.3.3 Using Different Data . . . . . . . . . . . . . . . . . . . 277 7.4 Uncertainty . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279 7.4.1 Likelihood Profiles . . . . . . . . . . . . . . . . . . . . 280 7.4.2 Bootstrap Confidence Intervals . . . . . . . . . . . . . 283 7.4.3 Parameter Correlations . . . . . . . . . . . . . . . . . 290 7.4.4 Asymptotic Errors . . . . . . . . . . . . . . . . . . . . 290 7.4.5 Sometimes Asymptotic Errors Work . . . . . . . . . . 297 7.4.6 Bayesian Posteriors. . . . . . . . . . . . . . . . . . . . 299 7.5 Management Advice . . . . . . . . . . . . . . . . . . . . . . . 308 7.5.1 Two Views of Risk . . . . . . . . . . . . . . . . . . . . 308 7.5.2 Harvest Strategies . . . . . . . . . . . . . . . . . . . . 309 7.6 Risk Assessment Projections . . . . . . . . . . . . . . . . . . 310 7.6.1 Deterministic Projections . . . . . . . . . . . . . . . . 310 7.6.2 Accounting for Uncertainty . . . . . . . . . . . . . . . 313 7.6.3 Using Asymptotic Errors . . . . . . . . . . . . . . . . 314 7.6.4 Using Bootstrap Parameter Vectors . . . . . . . . . . 316 7.6.5 Using Samples from a Bayesian Posterior . . . . . . . 316 7.7 Concluding Remarks . . . . . . . . . . . . . . . . . . . . . . 319 7.8 Appendix: The Use of Rcpp to Replace simpspm . . . . . . . 321 References 323 Index 335

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.