Leverage the full power of Bayesian analysis for competitive advantage Bayesian methods can solve problems you can'
535 99 11MB
English Pages 273 Year 2022
Table of contents :
Contents
Preface
1 Bayesian Analysis and R: An Overview
Bayes Comes Back
About Structuring Priors
Watching the Jargon
Priors, Likelihoods, and Posteriors
The Prior
The Likelihood
Contrasting a Frequentist Analysis with a Bayesian
The Frequentist Approach
The Bayesian Approach
Summary
2 Generating Posterior Distributions with the Binomial
Distribution
Understanding the Binomial Distribution
Understanding Some Related Functions
Working with R’s Binomial Functions
Using R’s dbinom Function
Using R’s pbinom Function
Using R’s qbinom Function
Using R’s rbinom Function
Grappling with the Math
Summary
3 Understanding the Beta Distribution
Establishing the Beta Distribution in Excel
Comparing the Beta Distribution with the Binomial Distribution
Decoding Excel’s Help Documentation for BETA.DIST
Replicating the Analysis in R
Understanding dbeta
Understanding pbeta
Understanding qbeta
About Confidence Intervals
Applying qbeta to Confidence Intervals
Applying BETA.INV to Confidence Intervals
Summary
4 Grid Approximation and the Beta Distribution
More on Grid Approximation
Setting the Prior
Using the Results of the Beta Function
Tracking the Shape and Location of the Distribution
Inventorying the Necessary Functions
Looking Behind the Curtains
Moving from the Underlying Formulas to the Functions
Comparing Built-in Functions with Underlying Formulas
Understanding Conjugate Priors
Summary
5 Grid Approximation with Multiple Parameters
Setting the Stage
Global Options
Local Variables
Specifying the Order of Execution
Normal Curves, Mu and Sigma
Visualizing the Arrays
Combining Mu and Sigma
Putting the Data Together
Calculating the Probabilities
Folding in the Prior
Inventorying the Results
Viewing the Results from Different Perspectives
Summary
6 Regression Using Bayesian Methods
Regression à la Bayes
Sample Regression Analysis
Matrix Algebra Methods
Understanding quap
Continuing the Code
A Full Example
Designing the Multiple Regression
Arranging a Bayesian Multiple Regression
Summary
7 Handling Nominal Variables
Using Dummy Coding
Supplying Text Labels in Place of Codes
Comparing Group Means
Summary
8 MCMC Sampling Methods
Quick Review of Bayesian Sampling
Grid Approximation
Quadratic Approximation
MCMC Gets Up To Speed
A Sample MCMC Analysis
ulam’s Output
Validating the Results
Getting Trace Plot Charts
Summary and Concluding Thoughts
Appendix Installation Instructions for RStan and the
rethinking Package on the Windows Platform
Glossary
Index