ebook img

Bayesian Data Analysis in Ecology Using Linear Models with R, BUGS and Stan PDF

329 Pages·2015·4.04 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 Bayesian Data Analysis in Ecology Using Linear Models with R, BUGS and Stan

Bayesian Data Analysis in Ecology Using Linear Models with R, BUGS, and Stan This page intentionally left blank Bayesian Data Analysis in Ecology Using Linear Models with R, BUGS, and Stan Fra¨nzi Korner-Nievergelt Tobias Roth Stefanie von Felten Je´roˆme Gue´lat Bettina Almasi Pius Korner-Nievergelt AMSTERDAM lBOSTON lHEIDELBERGl LONDON NEWYORK lOXFORDlPARIS lSANDIEGO SANFRANCISCOl SINGAPORElSYDNEYlTOKYO AcademicPressisanimprintofElsevier AcademicPressisanimprintofElsevier 32JamestownRoad,LondonNW17BY,UK 525BStreet,Suite 1800,SanDiego,CA 92101-4495,USA 225WymanStreet,Waltham,MA02451,USA TheBoulevard,LangfordLane,Kidlington,OxfordOX51GB,UK Copyright(cid:1)2015ElsevierInc.Allrightsreserved. Nopartofthispublicationmaybereproduced ortransmittedinanyformorby anymeans,electronicormechanical, includingphotocopying, recording,orany informationstorageandretrievalsystem,withoutpermissioninwritingfromthe publisher.Detailsonhowtoseekpermission,furtherinformationaboutthePublisher’s permissionspolicies andourarrangementwithorganizationssuchastheCopyright Clearance Center andtheCopyrightLicensingAgency,canbefoundatourwebsite: www.elsevier.com/permissions Thisbookandtheindividualcontributionscontainedinitareprotectedundercopyright bythePublisher(otherthanasmaybenotedherein). Notices Knowledgeandbestpracticeinthisfieldareconstantlychanging.Asnewresearchand experiencebroadenourunderstanding,changesinresearchmethods,professional practices, ormedicaltreatmentmaybecomenecessary. Practitionersandresearchersmustalwaysrelyontheirownexperienceandknowledge inevaluating andusinganyinformation,methods,compounds,orexperiments describedherein.Inusingsuchinformationormethodstheyshouldbemindfuloftheir ownsafetyandthesafetyofothers,includingpartiesforwhomtheyhaveaprofessional responsibility. Tothefullestextentofthelaw,neitherthePublishernortheauthors,contributors,or editors,assumeanyliabilityforanyinjuryand/ordamagetopersonsorpropertyasa matterofproductsliability,negligenceorotherwise,orfromanyuseoroperationof anymethods,products,instructions, orideas containedinthematerialherein. ISBN:978-0-12-801370-0 BritishLibrary CataloguinginPublicationData Acatalogue recordforthisbookisavailablefromtheBritishLibrary LibraryofCongressCataloging-in-Publication Data AcatalogrecordforthisbookisavailablefromtheLibraryofCongress ForinformationonallAcademicPressPublications visitourwebsiteat http://store.elsevier.com/ PrintedandboundintheUSA Contents DigitalAssets x Acknowledgments xi 1. Why do we Need Statistical Models and What is this Book About? 1 1.1 WhyWeNeedStatisticalModels 1 1.2 WhatThisBook isAbout 2 FurtherReading 4 2. Prerequisites and Vocabulary 5 2.1 Software 5 2.1.1 WhatIsR? 5 2.1.2 WorkingwithR 6 2.2 ImportantStatisticalTermsandHow toHandleThem inR 7 2.2.1 DataSets,Variables,andObservations 7 2.2.2 DistributionsandSummaryStatistics 12 2.2.3 MoreonRObjects 15 2.2.4 RFunctionsforGraphics 16 2.2.5 WritingOurOwnRFunctions 17 FurtherReading 18 3. The Bayesian and the Frequentist Ways of Analyzing Data 19 3.1 ShortHistoricalOverview 19 3.2 TheBayesianWay 20 3.2.1 EstimatingtheMeanofaNormalDistribution withaKnownVariance 21 3.2.2 EstimatingMeanandVarianceofaNormal DistributionUsingSimulation 22 3.3 TheFrequentistWay 27 3.4 ComparisonoftheBayesianandtheFrequentist Ways 30 FurtherReading 31 v vi Contents 4. Normal Linear Models 33 4.1 LinearRegression 33 4.1.1 Background 33 4.1.2 FittingaLinearRegressioninR 36 4.1.3 DrawingConclusions 36 4.1.4 FrequentistResults 41 4.2 RegressionVariants:ANOVA,ANCOVA,andMultiple Regression 42 4.2.1 One-WayANOVA 42 4.2.2 FrequentistResultsfromaOne-WayANOVA 47 4.2.3 Two-WayANOVA 49 4.2.4 FrequentistResultsfromaTwo-WayANOVA 53 4.2.5 MultipleComparisonsandPostHocTests 55 4.2.6 AnalysisofCovariance 56 4.2.7 MultipleRegressionandCollinearity 60 4.2.8 OrderedFactorsandContrasts 64 4.2.9 QuadraticandHigherPolynomialTerms 66 FurtherReading 67 5. Likelihood 69 5.1 Theory 69 5.2 TheMaximumLikelihoodMethod 72 5.3 TheLogPointwisePredictiveDensity 73 FurtherReading 74 6. Assessing Model Assumptions 75 6.1 ModelAssumptions 75 6.2 Independent andIdenticallyDistributed 76 6.3 TheQQPlot 79 6.4 TemporalAutocorrelation 80 6.5 SpatialAutocorrelation 85 6.6 Heteroscedasticity 91 FurtherReading 94 7. Linear Mixed Effects Models 95 7.1 Background 95 7.1.1 WhyMixedEffectsModels? 95 7.1.2 RandomFactorsandPartialPooling 96 7.2 Fitting aLinearMixedModelinR 98 7.3 RestrictedMaximumLikelihoodEstimation 101 7.4 AssessingModelAssumptions 102 7.5 DrawingConclusions 103 7.6 FrequentistResults 105 7.7 RandomIntercept andRandomSlope 106 Contents vii 7.8 NestedandCrossed RandomEffects 111 7.9 ModelSelectioninMixedModels 114 FurtherReading 114 8. Generalized Linear Models 115 8.1 Background 115 8.2 BinomialModel 117 8.2.1 Background 117 8.2.2 FittingaBinomialModelinR 118 8.2.3 AssessingModelAssumptions:Overdispersion andZero-Inflation 121 8.2.4 DrawingConclusions 126 8.2.5 FrequentistResults 127 8.3 Fitting aBinary Logistic RegressioninR 128 8.3.1 SomeFinalRemarks 131 8.4 PoissonModel 132 8.4.1 Background 132 8.4.2 FittingaPoisson-ModelinR 134 8.4.3 AssessingModelAssumptions 135 8.4.4 DrawingConclusions 136 8.4.5 ModelingRatesandDensities:PoissonModel withanOffset 137 8.4.6 FrequentistResults 138 FurtherReading 139 9. Generalized Linear Mixed Models 141 9.1 BinomialMixedModel 141 9.1.1 Background 141 9.1.2 FittingaBinomialMixedModelinR 142 9.1.3 AssessingModelAssumptions 143 9.1.4 DrawingConclusions 145 9.2 PoissonMixedModel 146 9.2.1 Background 146 9.2.2 FittingaPoissonMixedModelinR 146 9.2.3 AssessingModelAssumptions 148 9.2.4 DrawingConclusions 149 9.2.5 ModelingBirdDensitiesbyaPoissonMixed ModelIncludinganOffset 151 FurtherReading 159 10. Posterior Predictive Model Checking and Proportion of Explained Variance 161 10.1 PosteriorPredictiveModelChecking 161 10.2 MeasuresofExplainedVariance 169 FurtherReading 174 viii Contents 11. Model Selection and Multimodel Inference 175 11.1 When andWhyWeSelectModelsandWhyThis isDifficult 175 11.2 Methods forModelSelectionandModelComparisons 179 11.2.1 Cross-Validation 179 11.2.2 InformationCriteria:AkaikeInformation CriterionandWidelyApplicable InformationCriterion 181 11.2.3 OtherInformationCriteria 183 11.2.4 BayesFactorsandPosterior Model Probabilities 184 11.2.5 Model-BasedMethodstoObtainPosterior ModelProbabilitiesandInclusion Probabilities 184 11.2.6 “LeastAbsoluteShrinkageandSelection Operator”(LASSO)andRidgeRegression 185 11.3 MultimodelInference 188 11.4 Which MethodtoChooseandWhichStrategytoFollow 193 FurtherReading 196 12. Markov Chain Monte Carlo Simulation 197 12.1 Background 197 12.2 MCMCUsingBUGS 201 12.2.1 UsingBUGSfromOpenBUGS 202 12.2.2 UsingBUGSfromR 204 12.3 MCMCUsingStan 206 12.4 Sim,BUGS,andStan 211 FurtherReading 212 13. Modeling Spatial Data Using GLMM 213 13.1 Background 213 13.2 Modeling Assumptions 214 13.3 Explicit ModelingofSpatialAutocorrelation 214 13.3.1 StartingtheModelFitting 214 13.3.2 VariogramModeling 216 13.3.3 BayesianModeling 216 13.3.4 OpenBUGSExample 222 FurtherReading 224 14. Advanced Ecological Models 225 14.1 HierarchicalMultinomialModeltoAnalyzeHabitat SelectionUsingBUGS 225 14.2 Zero-InflatedPoisson MixedModelforAnalyzing Breeding SuccessUsingStan 231 Contents ix 14.3 OccupancyModeltoMeasureSpeciesDistribution UsingStan 240 14.4 TerritoryOccupancyModeltoEstimateSurvival UsingBUGS 246 14.5 AnalyzingSurvivalBasedonMark-RecaptureData UsingStan 252 FurtherReading 263 15. Prior Influence and Parameter Estimability 265 15.1 HowtoSpecifyPriorDistributions 265 15.2 PriorSensitivityAnalysis 269 15.3 ParameterEstimability 273 FurtherReading 278 16. Checklist 279 16.1 DataAnalysisStepbyStep 279 FurtherReading 287 17. What Should I Report in a Paper 289 17.1 HowtoPresent theResults 289 17.2 HowtoWriteUptheStatisticalMethods 293 FurtherReading 296 References 297 Index 309

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.