bayesian hierarchical models - ubc department of …gavin/stepibooknewstyle/course/clapem/... · 1/...
TRANSCRIPT
![Page 1: Bayesian Hierarchical Models - UBC Department of …gavin/STEPIBookNewStyle/course/clapem/... · 1/ 20 R and RStudioStatistical AnalysesPackagesR-INLA Bayesian Hierarchical Models](https://reader033.vdocument.in/reader033/viewer/2022051308/5aeae6a07f8b9a36698d9ef8/html5/thumbnails/1.jpg)
1/ 20
R and RStudio Statistical Analyses Packages R-INLA
Bayesian Hierarchical Models
Gavin Shaddick,
Millie Green, Matthew ThomasUniversity of Bath
6th - 9th December 2016
![Page 2: Bayesian Hierarchical Models - UBC Department of …gavin/STEPIBookNewStyle/course/clapem/... · 1/ 20 R and RStudioStatistical AnalysesPackagesR-INLA Bayesian Hierarchical Models](https://reader033.vdocument.in/reader033/viewer/2022051308/5aeae6a07f8b9a36698d9ef8/html5/thumbnails/2.jpg)
2/ 20
R and RStudio Statistical Analyses Packages R-INLA
IMPLEMENTING BAYESIANMODELS USING R-INLA
![Page 3: Bayesian Hierarchical Models - UBC Department of …gavin/STEPIBookNewStyle/course/clapem/... · 1/ 20 R and RStudioStatistical AnalysesPackagesR-INLA Bayesian Hierarchical Models](https://reader033.vdocument.in/reader033/viewer/2022051308/5aeae6a07f8b9a36698d9ef8/html5/thumbnails/3.jpg)
3/ 20
R and RStudio Statistical Analyses Packages R-INLA
OUTLINE
R and RStudio
Statistical Analyses
Packages
R-INLA
![Page 4: Bayesian Hierarchical Models - UBC Department of …gavin/STEPIBookNewStyle/course/clapem/... · 1/ 20 R and RStudioStatistical AnalysesPackagesR-INLA Bayesian Hierarchical Models](https://reader033.vdocument.in/reader033/viewer/2022051308/5aeae6a07f8b9a36698d9ef8/html5/thumbnails/4.jpg)
4/ 20
R and RStudio Statistical Analyses Packages R-INLA
R and RStudio
![Page 5: Bayesian Hierarchical Models - UBC Department of …gavin/STEPIBookNewStyle/course/clapem/... · 1/ 20 R and RStudioStatistical AnalysesPackagesR-INLA Bayesian Hierarchical Models](https://reader033.vdocument.in/reader033/viewer/2022051308/5aeae6a07f8b9a36698d9ef8/html5/thumbnails/5.jpg)
5/ 20
R and RStudio Statistical Analyses Packages R-INLA
R
![Page 6: Bayesian Hierarchical Models - UBC Department of …gavin/STEPIBookNewStyle/course/clapem/... · 1/ 20 R and RStudioStatistical AnalysesPackagesR-INLA Bayesian Hierarchical Models](https://reader033.vdocument.in/reader033/viewer/2022051308/5aeae6a07f8b9a36698d9ef8/html5/thumbnails/6.jpg)
6/ 20
R and RStudio Statistical Analyses Packages R-INLA
RSTUDIO
![Page 7: Bayesian Hierarchical Models - UBC Department of …gavin/STEPIBookNewStyle/course/clapem/... · 1/ 20 R and RStudioStatistical AnalysesPackagesR-INLA Bayesian Hierarchical Models](https://reader033.vdocument.in/reader033/viewer/2022051308/5aeae6a07f8b9a36698d9ef8/html5/thumbnails/7.jpg)
7/ 20
R and RStudio Statistical Analyses Packages R-INLA
Statistical Analyses
![Page 8: Bayesian Hierarchical Models - UBC Department of …gavin/STEPIBookNewStyle/course/clapem/... · 1/ 20 R and RStudioStatistical AnalysesPackagesR-INLA Bayesian Hierarchical Models](https://reader033.vdocument.in/reader033/viewer/2022051308/5aeae6a07f8b9a36698d9ef8/html5/thumbnails/8.jpg)
8/ 20
R and RStudio Statistical Analyses Packages R-INLA
STATISTICAL ANALYSIS IN R
I R comes with many statistical tools already installedI descriptive statisticsI visualisationI statistical testsI model fitting.
![Page 9: Bayesian Hierarchical Models - UBC Department of …gavin/STEPIBookNewStyle/course/clapem/... · 1/ 20 R and RStudioStatistical AnalysesPackagesR-INLA Bayesian Hierarchical Models](https://reader033.vdocument.in/reader033/viewer/2022051308/5aeae6a07f8b9a36698d9ef8/html5/thumbnails/9.jpg)
9/ 20
R and RStudio Statistical Analyses Packages R-INLA
Packages
![Page 10: Bayesian Hierarchical Models - UBC Department of …gavin/STEPIBookNewStyle/course/clapem/... · 1/ 20 R and RStudioStatistical AnalysesPackagesR-INLA Bayesian Hierarchical Models](https://reader033.vdocument.in/reader033/viewer/2022051308/5aeae6a07f8b9a36698d9ef8/html5/thumbnails/10.jpg)
10/ 20
R and RStudio Statistical Analyses Packages R-INLA
CAN R DO MORE?
I The default installation of R has a comprehensive set of tools forstatistical analyses.
I To meet the specific needs of data scientists, many otherstatistical tools are readily available in the form of packages.
I Packages are collections of functions and data.I "During the last decade, the momentum coming from both
academia and industry has lifted R to become the single mostimportant tool for computational statistics, visualisation anddata science."
![Page 11: Bayesian Hierarchical Models - UBC Department of …gavin/STEPIBookNewStyle/course/clapem/... · 1/ 20 R and RStudioStatistical AnalysesPackagesR-INLA Bayesian Hierarchical Models](https://reader033.vdocument.in/reader033/viewer/2022051308/5aeae6a07f8b9a36698d9ef8/html5/thumbnails/11.jpg)
11/ 20
R and RStudio Statistical Analyses Packages R-INLA
R PACKAGES: EXAMPLES USED IN THIS COURSE
I ggplot2
I raster
I Rmisc
I mgcv
I maptools
I ... many many more!!
![Page 12: Bayesian Hierarchical Models - UBC Department of …gavin/STEPIBookNewStyle/course/clapem/... · 1/ 20 R and RStudioStatistical AnalysesPackagesR-INLA Bayesian Hierarchical Models](https://reader033.vdocument.in/reader033/viewer/2022051308/5aeae6a07f8b9a36698d9ef8/html5/thumbnails/12.jpg)
12/ 20
R and RStudio Statistical Analyses Packages R-INLA
OTHER R PACKAGES
I A list of R Packages can be seen and downloaded fromhttps://cran.r-project.org
![Page 13: Bayesian Hierarchical Models - UBC Department of …gavin/STEPIBookNewStyle/course/clapem/... · 1/ 20 R and RStudioStatistical AnalysesPackagesR-INLA Bayesian Hierarchical Models](https://reader033.vdocument.in/reader033/viewer/2022051308/5aeae6a07f8b9a36698d9ef8/html5/thumbnails/13.jpg)
13/ 20
R and RStudio Statistical Analyses Packages R-INLA
R-INLA
![Page 14: Bayesian Hierarchical Models - UBC Department of …gavin/STEPIBookNewStyle/course/clapem/... · 1/ 20 R and RStudioStatistical AnalysesPackagesR-INLA Bayesian Hierarchical Models](https://reader033.vdocument.in/reader033/viewer/2022051308/5aeae6a07f8b9a36698d9ef8/html5/thumbnails/14.jpg)
14/ 20
R and RStudio Statistical Analyses Packages R-INLA
R-INLA
I The R–INLA package provides a practical implementation ofIntegrated Nested Laplace Approximations (INLA).
I The class of models that can be expressed in this form and thuscan be used with R–INLA is very large and includes, amongstothers, the following:
I Dynamic linear models.I Stochastic volatility models.I Generalised linear (mixed) models.I Generalised additive (mixed) models.I Spline smoothing.I Semi–parametric regression.I Disease mapping.I Log–Gaussian Cox–processes.I Model–based geostatistics.I Spatio–temporal models.I Survival analysis.
![Page 15: Bayesian Hierarchical Models - UBC Department of …gavin/STEPIBookNewStyle/course/clapem/... · 1/ 20 R and RStudioStatistical AnalysesPackagesR-INLA Bayesian Hierarchical Models](https://reader033.vdocument.in/reader033/viewer/2022051308/5aeae6a07f8b9a36698d9ef8/html5/thumbnails/15.jpg)
15/ 20
R and RStudio Statistical Analyses Packages R-INLA
THE SYNTAX OF R–INLA
I There are three main parts to fitting a model using R–INLA:1. The data.2. Defining the model formula.3. The call to the INLA program.
I The basic syntax of running models in R–INLA is very similar inappearance to that of glm in R and takes the general formformula, data, family but with the addition of thespecification of the nature of the random effects, f().
I For the latter component, common examples includeI f(i, model="iid") (independent)I f(i, model="rw") (random walk of order one)I f(i, model="ar") (autoregressive of order p).
![Page 16: Bayesian Hierarchical Models - UBC Department of …gavin/STEPIBookNewStyle/course/clapem/... · 1/ 20 R and RStudioStatistical AnalysesPackagesR-INLA Bayesian Hierarchical Models](https://reader033.vdocument.in/reader033/viewer/2022051308/5aeae6a07f8b9a36698d9ef8/html5/thumbnails/16.jpg)
16/ 20
R and RStudio Statistical Analyses Packages R-INLA
FITTING A POISSON REGRESSION MODEL IN R–INLA
I An extension of the standard Poisson model to includelog–normal random effects in the linear predictor
logµl = β0 + β0i + β1Xl + βdXl + εl (1)
where βl represents the effect of exposure, βd is the effect of anarea-level covariate and β0i denotes the random effect for area i.
I The syntax of the R–INLA code to fit this model is very similar tothat of a standard glm in R.
![Page 17: Bayesian Hierarchical Models - UBC Department of …gavin/STEPIBookNewStyle/course/clapem/... · 1/ 20 R and RStudioStatistical AnalysesPackagesR-INLA Bayesian Hierarchical Models](https://reader033.vdocument.in/reader033/viewer/2022051308/5aeae6a07f8b9a36698d9ef8/html5/thumbnails/17.jpg)
17/ 20
R and RStudio Statistical Analyses Packages R-INLA
FITTING A POISSON REGRESSION MODEL IN R–INLA
![Page 18: Bayesian Hierarchical Models - UBC Department of …gavin/STEPIBookNewStyle/course/clapem/... · 1/ 20 R and RStudioStatistical AnalysesPackagesR-INLA Bayesian Hierarchical Models](https://reader033.vdocument.in/reader033/viewer/2022051308/5aeae6a07f8b9a36698d9ef8/html5/thumbnails/18.jpg)
18/ 20
R and RStudio Statistical Analyses Packages R-INLA
FITTING A POISSON REGRESSION MODEL IN R–INLA
![Page 19: Bayesian Hierarchical Models - UBC Department of …gavin/STEPIBookNewStyle/course/clapem/... · 1/ 20 R and RStudioStatistical AnalysesPackagesR-INLA Bayesian Hierarchical Models](https://reader033.vdocument.in/reader033/viewer/2022051308/5aeae6a07f8b9a36698d9ef8/html5/thumbnails/19.jpg)
19/ 20
R and RStudio Statistical Analyses Packages R-INLA
FITTING A POISSON REGRESSION MODEL IN R–INLA
![Page 20: Bayesian Hierarchical Models - UBC Department of …gavin/STEPIBookNewStyle/course/clapem/... · 1/ 20 R and RStudioStatistical AnalysesPackagesR-INLA Bayesian Hierarchical Models](https://reader033.vdocument.in/reader033/viewer/2022051308/5aeae6a07f8b9a36698d9ef8/html5/thumbnails/20.jpg)
20/ 20
R and RStudio Statistical Analyses Packages R-INLA
FITTING MODELS IN R–INLA
I Future details can be found on the R–INLA webpage:http://www.R-INLA.org.