rjags Introduction Parameters: How to determine the parameters of a statistical model

Size: px
Start display at page:

Download "rjags Introduction Parameters: How to determine the parameters of a statistical model"

Transcription

1 January 25, 207 File = E:\inet\p548\demo.04-2.rjags.intro.docm John Miyamoto ( jmiyamot@uw.edu) Psych 548: Bayesian Statistics, Modeling & Reasoning Winter 207 Course website: rjags Introduction rjags is an R package; its function create an interface between R and JAGS. This document provides a brief introduction to functions that send information from R to JAGS, thereby defining the statistical model and data that determine the posterior distribution from which JAGS must draw a sample, and functions that transfer the results of this computation back to R. Contents (Cntrl-left click on a link to jump to the corresponding section) Section Topic Basic Steps in Running JAGS with rjags Annotated code for a typical rjags run Functions in the rjags package Parameters: How to determine the parameters of a statistical model The structure of coda.samples output 6 # End of Contents Table Random seeds: Setting random number generators for JAGS. Basic Steps in Running JAGS with rjags TOC The following are typical steps in running JAGS with rjags. There are ways to alter these steps that won't be discussed here. PRELIMINARIES TO THE JAGS RUN: (i) Run R. Load rjags onto the search path by using the library or require function. (ii) Create a model file. This is a text file written in the JAGS language that defines the statistical model that is assumed to generate the data. This step is very important. The model file defines the model(s) that you are intending to study. You must know (keep a record of) the name of the model file, the names of every data object (vector, matrix, list) that you intend to pass from R to JAGS. You must know the names of every parameter in your model. (iii) In R, create a named list whose components are the data objects (vectors, matrices, lists) that you intend to pass to JAGS. These names must be identical to the variable names that reference these objects in the model file. (iv) Create variables that define how the JAGS run should proceed. These variables include things like the number of chains of samples to compute, how many burnin samples to compute, which parameter values should be sent back to R and which can be discarded, etc. rjags FUNCTIONS FOR RUNNING JAGS: jags.model This function tells JAGS what is the model that you are fitting, what are the data, what are the initial values of parameters, how many chains, and how many adaptation steps. update The update function is not part of the rjags package; rather it is part of the standard R installation. The update function has many uses in classical statistical procedures as well as in Bayesian statistical procedures. From the standpoint of running JAGS, the update function is used to run the burnin samples. JAGS computes the samples for the burnin sample but it does not save them. Alternatively, you can create a named list whose components are the names of the data objects that you intend to pass to JAGS. This has the same effect when you run JAGS.

2 January 25, 207 File = E:\inet\p548\demo.04-2.rjags.intro.docm 2 coda.samples jags.samples This function tells JAGS to compute the samples that you want to save and return to R. The samples are returned to R in the form of an MCMC list, which is a special kind of list that is designed for exploring convergence diagnostics. This function serves a similar purpose to the coda.samples function. The primary difference between coda.samples and jags.samples is in the structure of the output of these functions. Both functions draw samples from the posterior distribution, given an appropriate data set and definition of a model. The output from the coda.samples function is designed to serve as inputs to the convergence diagnostic functions in the coda package. As a practical matter, you only need to work with one of these functions since the output from either function can be transformed into the structure of the output from the other function. The remainder of this document will discuss only the coda.samples function. 2. Annotated code for a typical rjags run TOC Table. Variables in R that control the rjags run # R Code # Explanation # Set run parameters (settings that control the run) : model.file = "name of model file" datalist = list(... ) parameters =... n.chains =... # Method for setting initial values inits.lst = list( list(... ),..., list(... ) ) # Method 2 for setting initial values inits.fn = function() { list(... ) } #end def of 'inits.fn =' function # Method for setting initial values inits.fn = NULL n.adapt =... n.burnin =... 2: Include path to file if necessary : Make a named list of data objects that will be passed to JAGS. Alternatively, you can simply make a list of the names of the data objects. 4: Vector of names of variables to be monitored (saved). These names appear in the model file. 5: Set number of chains 6: The initial values can be specified in a list. The list is itself comprised of lists, one component list per chain in the simulation. E.g., if you request chains at Row 5, then you should provide a list with component lists, one for each chain. The component list has named components, the names being identical to the names of parameters in the statistical model. 7: The initial values is set by a function that outputs a list. Each list has named components setting initial values for every sampled parameter in the model file. 8: If you set the initial values to NULL (or if you totally omit any specification of the initial values), then JAGS will choose initial values at random from the permissible values of parameters. This is the easiest way to deal with initial values. 9: Set the number of adaptation steps to tune the sampler. 0: Set number of iterations for burnin. n.iter =... : Set the number of samples to be kept after the burnin samples are discarded. n.thin =... 2: Set the thinning rate. # Start of rjags control of an JAGS run. j.mod = jags.model( file = model.file, data = datalist, inits = inits.lst, n.chains = n.chains, n.adapt = n.adapt ) : 4t0002_007: jags.model is used to create an object representing a Bayesian graphical model, specified with a BUGSlanguage description of the prior distribution, and a set of data. Note that the output (j.mod in this case) is not the samples from the posterior. It is a list whose components define the model. You can omit inits and n.adapt; JAGS will decide for itself how to set these values.

3 January 25, 207 File = E:\inet\p548\demo.04-2.rjags.intro.docm # R Code # Explanation update( object = j.mod, n.iter = n.burnin ) j.out = coda.samples( model = j.mod, variable.names = parameters, n.iter = n.iter, thin = n.thin ) 5: Compute burnin samples. They will not be saved. 6: coda.samples outputs the chains of samples in MCMC list format. The output is a list of class "mcmc.list". Comment : One can replace the call to coda.samples with a call to jags.samples - the latter function outputs the chains as a list of arrays. For example, if the variable sigma is not indexed, i.e., there is no sigma[], sigma[2],..., then jags.samples will output an array of dimension n.iter n.chains for the sigma variable. If the beta variable has 5 indices, beta[],..., beta[5], then jags.samples will output a list that has a beta component with dimension 5 n.iter n.chains. Comment 2: It may be useful to apply the jags.chains function to the output from coda.samples. The syntax would be: new.chains = jags.chains( sample = j.out, model = j.mod ). Functions in the rjags package TOC Table 2. Functions in the rjags package jags Function Explanation coda.samples This is a wrapper function for jags.samples which sets a trace monitor for all requested nodes, updates the model, and coerces the output to a single mcmc.list object. jags.samples extracts random samples from the posterior distribution of the parameters of a jags model. jags.model jags.samples jags.samples and coda.samples perform the same computations, but they differ in how they structure the output. jags.samples returns the output in the form of a special kind of array in the class mcarray. coda.samples returns the output in the form of a special kind of list in the class mcmc.list. An mcmc.list object is structured to serve as input to functions in the coda package which contains a variety of functions for MCMC convergence diagnostics. jags.model is used to create an object representing a Bayesian graphical model, specified with a BUGS-language description of the prior distribution, and a set of data. Note: Its output is a specification of the model; the output is not the actual samples from the posterior distribution. Use jags.sample, coda.samples and update to compute samples. jags.samples extracts random samples from the posterior distribution of the parameters of a jags model. jags.samples and coda.samples perform the same computations, but they differ in how they structure the output. jags.samples returns the output in the form of a special kind of array in the class mcarray. coda.samples returns the output in the form of a special kind of list in the class mcmc.list. An mcmc.list object is structured to serve as input to functions in the coda package which contains a variety of functions for MCMC convergence diagnostics. read.bugsdata Read data for a JAGS model from a file. read.jagsdata Read data for a JAGS model from a file. update This function is not part of the rjags package (it is part of the stats package, which is installed by default along with the standard R installation). update can be used to sample from a posterior without saving the samples. This is useful when drawing burnin samples. ord

4 January 25, 207 File = E:\inet\p548\demo.04-2.rjags.intro.docm 4 jags Function Explanation Below: Technical functions, less important for the novice adapt Run the adaptation iterations for tuning the sampler. This function is not normally called by the user. It is called by the jags.model function when the model object is created. dic.samples Function to extract random samples of the penalized deviance from a jags model. diffdic Compare two models by the difference of two dic objects. list.factories JAGS modules contain factory objects for samplers, monitors, and random number generators for a JAGS model. These functions allow fine-grained control over which factories are active. list.factories returns a data frame with two columns, the first column shows the names of the factory objects in the currently loaded modules, and the second column is a logical vector indicating whether the corresponding factory is active or not. list.modules A JAGS module is a dynamically loaded library that extends the functionality of JAGS. These functions load and unload JAGS modules and show the names of the currently loaded modules. This function lists the currently loaded modules. list.samplers A jags object represents a Bayesian graphical model described using the BUGS language. The output displays the algorithms that have been applied to each model parameter in the computation of the MCMC chain. load.module A JAGS module is a dynamically loaded library that extends the functionality of JAGS. This function loads JAGS modules and shows the names of the currently loaded modules. parallel.seeds On a multi-processor system, you may wish to run parallel chains using multiple jags.model objects, each running a single chain on a separate processor. This function returns a list of values that may be used to initialize the random number generator of each chain. read.data OBSOLETE: This function is provided for compatibility with older versions of the rjags package and will soon be defunct. This function has been replaced with the read.jagsdata function in the current version of JAGS. set.factory JAGS modules contain factory objects for samplers, monitors, and random number generators for a JAGS model. These functions allow fine-grained control over which factories are active. set.factory is called to change the future behaviour of factory objects. If a factory is set to inactive then it will be skipped. unload.module A JAGS module is a dynamically loaded library that extends the functionality of JAGS. This function unloads JAGS modules and show the names of the currently loaded modules. ord 2 4. Parameters: How to determine the parameters of a statistical model TOC Sometimes it is advantageous to set initial values for chains of samples. At each iteration of a chain, the chain contains values for every parameter of the model. The initial values of a chain are the values of the parameters that the user specifies for the parameters of the statistical model; the user may want to examine multiple chains that have many different initial values in order to check whether some initial samples must be discarded in order to avoid undue influence from the initial values. To set initial values for the paramers, however, it is necessary to identify the parameters of the statistical model. How to do this? A researcher should be able to look at a model file and determine what are the parameters of the model. This is especially true if the researcher wrote the model file himself or herself. But sometimes this is difficult. An alternative is to run the jags.model function in rjags. Then apply the list.samplers function to the output of the jags.model function - this will produce a list of the MCMC sampling algorithm that has been applied to each parameter in the model, thereby identifying the model parameters. E.g., first run the jags.model function: jmodel = jags.model(... ) where we fill in appropriate values for the arguments of the jags.model function. Then we run:

5 January 25, 207 File = E:\inet\p548\demo.04-2.rjags.intro.docm 5 list.samplers( jmodel ) The output will show the names of the parameters that need to have initial values set for them. The variable.names function in rjags lists all variables in the model file, including constants, data variables and derived variables that do not have samplers assigned to them. The list.samplers function is more informative with regard to the question, what parameters require initial values?, because it lists only the parameters that are assigned random samplers. 5. The structure of coda.samples output TOC See the document convergence.diag.pdf that is titled, "Convergence Diagnostics: Working with coda.samples Output." 6. Random seeds: Setting random number generators for JAGS TOC See the documentation for jags.model. Random number generators are set through the specification of initial values. You need to set initial values for all model parameters. In addition, initial values are set for two additional components names.rng.name and.rng.seed..rng.name is a string that names a random number generator algorithm. See?set.seed to see the names of random number generators that are available in R. See?jags.model for the names of random number generators that are available in JAGS. RNGkind() shows the default random number generator for R. The following is an example of initial values for chains that set initial values for the JAGS random number generators: inivals = list(.rng.name = "base::mersenne-twister",.rng.seed = 2 ),.RNG.name = "base::mersenne-twister",.rng.seed = 4 ),.RNG.name = "base::mersenne-twister",.rng.seed = 6) ) # You have to set initial values for all of the parameters because if you don't, JAGS will choose initial values at random, and these choices will not be controlled by the.rng.seed that you choose in the initial values. jagsmodel = jags.model( file = "testmod.txt", data = datalist, inits = inivals, n.chains =, n.adapt = adaptsteps )

Package rjags. R topics documented: October 19, 2018

Package rjags. R topics documented: October 19, 2018 Version 4-8 Date 2018-10-19 Title Bayesian Graphical Models using MCMC Depends R (>= 2.14.0), coda (>= 0.13) SystemRequirements JAGS 4.x.y URL http://mcmc-jags.sourceforge.net Suggests tcltk Interface

More information

Test Run to Check the Installation of OpenBUGS, JAGS, BRugs, R2OpenBUGS, Rjags & R2jags

Test Run to Check the Installation of OpenBUGS, JAGS, BRugs, R2OpenBUGS, Rjags & R2jags John Miyamoto File = E:\bugs\test.bugs.install.docm 1 Test Run to Check the Installation of OpenBUGS, JAGS, BRugs, R2OpenBUGS, Rjags & R2jags The following annotated code is extracted from John Kruschke's

More information

Test Run to Check the Installation of JAGS & Rjags

Test Run to Check the Installation of JAGS & Rjags John Miyamoto File = D:\bugs\test.jags.install.docm 1 Test Run to Check the Installation of JAGS & Rjags The following annotated code is extracted from John Kruschke's R scripts, "E:\btut\r\BernBetaBugsFull.R"

More information

Package jagsui. December 12, 2017

Package jagsui. December 12, 2017 Version 1.4.9 Date 2017-12-08 Package jagsui December 12, 2017 Title A Wrapper Around 'rjags' to Streamline 'JAGS' Analyses Author Ken Kellner Maintainer Ken Kellner

More information

Demo 09-1a: One Sample (Single Group) Models

Demo 09-1a: One Sample (Single Group) Models March 8, 2017 File = D:\P548\demo.09-1a.p548.w17.docm 1 John Miyamoto (email: jmiyamot@uw.edu) Psych 548: Bayesian Statistics, Modeling & Reasoning Winter 2017 Course website: http://faculty.washington.edu/jmiyamot/p548/p548-set.htm

More information

Bayesian Modelling with JAGS and R

Bayesian Modelling with JAGS and R Bayesian Modelling with JAGS and R Martyn Plummer International Agency for Research on Cancer Rencontres R, 3 July 2012 CRAN Task View Bayesian Inference The CRAN Task View Bayesian Inference is maintained

More information

Bayesian Computation with JAGS

Bayesian Computation with JAGS JAGS is Just Another Gibbs Sampler Cross-platform Accessible from within R Bayesian Computation with JAGS What I did Downloaded and installed JAGS. In the R package installer, downloaded rjags and dependencies.

More information

ST440/540: Applied Bayesian Analysis. (5) Multi-parameter models - Initial values and convergence diagn

ST440/540: Applied Bayesian Analysis. (5) Multi-parameter models - Initial values and convergence diagn (5) Multi-parameter models - Initial values and convergence diagnostics Tuning the MCMC algoritm MCMC is beautiful because it can handle virtually any statistical model and it is usually pretty easy to

More information

An Ecological Modeler s Primer on JAGS

An Ecological Modeler s Primer on JAGS 1 An Ecological Modeler s Primer on JAGS 2 3 N. Thompson Hobbs May 19, 2014 4 5 6 Natural Resource Ecology Laboratory, Department of Ecosystem Science and Sustainability, and Graduate Degree Program in

More information

JAGS for Rats. Jonathan Rougier School of Mathematics University of Bristol UK. Version 2.0, compiled February 23, 2017

JAGS for Rats. Jonathan Rougier School of Mathematics University of Bristol UK. Version 2.0, compiled February 23, 2017 JAGS for Rats Jonathan Rougier School of Mathematics University of Bristol UK Version 2.0, compiled February 23, 2017 1 Introduction This is a worksheet about JAGS, using rjags. These must both be installed

More information

Introduction to Applied Bayesian Modeling A brief JAGS and R2jags tutorial

Introduction to Applied Bayesian Modeling A brief JAGS and R2jags tutorial Introduction to Applied Bayesian Modeling A brief JAGS and R2jags tutorial Johannes Karreth University of Georgia jkarreth@uga.edu ICPSR Summer Program 2011 Last updated on July 7, 2011 1 What are JAGS,

More information

JAGS Version user manual. Martyn Plummer

JAGS Version user manual. Martyn Plummer JAGS Version 4.3.0 user manual Martyn Plummer 28 June 2017 Contents 1 Introduction 4 1.1 Downloading JAGS................................. 4 1.2 Getting help..................................... 4 1.3

More information

Package dalmatian. January 29, 2018

Package dalmatian. January 29, 2018 Package dalmatian January 29, 2018 Title Automating the Fitting of Double Linear Mixed Models in 'JAGS' Version 0.3.0 Date 2018-01-19 Automates fitting of double GLM in 'JAGS'. Includes automatic generation

More information

Package rbugs. February 20, 2015

Package rbugs. February 20, 2015 Title Fusing R and OpenBugs and Beyond Date 2011-02-19 Version 0.5-9 Package rbugs February 20, 2015 Author Jun Yan and Marcos Prates Functions to prepare files

More information

A Basic Example of ANOVA in JAGS Joel S Steele

A Basic Example of ANOVA in JAGS Joel S Steele A Basic Example of ANOVA in JAGS Joel S Steele The purpose This demonstration is intended to show how a simple one-way ANOVA can be coded and run in the JAGS framework. This is by no means an exhaustive

More information

Hierarchical modeling of individual subjects nested within treatment conditions

Hierarchical modeling of individual subjects nested within treatment conditions February 22, 2017 File = D:\bcm\ch10.indiv.difs.mem.reten.docm 1 John Miyamoto (email: jmiyamot@uw.edu) Psych 548: Bayesian Statistics, Modeling & Reasoning Winter 2017 Course website: http://faculty.washington.edu/jmiyamot/p548/p548-set.htm

More information

Package lira. October 27, 2017

Package lira. October 27, 2017 Type Package Title LInear Regression in Astronomy Version 2.0.0 Date 2017-10-27 Author Mauro Sereno Package lira October 27, 2017 Maintainer Mauro Sereno Description Performs Bayesian

More information

BUGS: Language, engines, and interfaces

BUGS: Language, engines, and interfaces BUGS: Language, engines, and interfaces Patrick Breheny January 17 Patrick Breheny BST 701: Bayesian Modeling in Biostatistics 1/18 The BUGS framework The BUGS project (Bayesian inference using Gibbs Sampling)

More information

Running WinBUGS from within R

Running WinBUGS from within R Applied Bayesian Inference A Running WinBUGS from within R, KIT WS 2010/11 1 Running WinBUGS from within R 1 Batch Mode Although WinBUGS includes methods to analyze the output of the Markov chains like

More information

Package bdpopt. March 30, 2016

Package bdpopt. March 30, 2016 Version 1.0-1 Date 2016-03-29 Title Optimisation of Bayesian Decision Problems Author Sebastian Jobjörnsson [aut, cre] Package bdpopt March 30, 2016 Maintainer Depends R (>= 3.0.2) Optimisation of the

More information

Simulated example: Estimating diet proportions form fatty acids and stable isotopes

Simulated example: Estimating diet proportions form fatty acids and stable isotopes Simulated example: Estimating diet proportions form fatty acids and stable isotopes Philipp Neubauer Dragonfly Science, PO Box 755, Wellington 6, New Zealand June, Preamble DISCLAIMER: This is an evolving

More information

winbugs and openbugs

winbugs and openbugs Eric F. Lock UMN Division of Biostatistics, SPH elock@umn.edu 04/19/2017 Bayesian estimation software Several stand-alone applications and add-ons to estimate Bayesian models Stand-alone applications:

More information

Package BayesCR. September 11, 2017

Package BayesCR. September 11, 2017 Type Package Package BayesCR September 11, 2017 Title Bayesian Analysis of Censored Regression Models Under Scale Mixture of Skew Normal Distributions Version 2.1 Author Aldo M. Garay ,

More information

Package bmeta. R topics documented: January 8, Type Package

Package bmeta. R topics documented: January 8, Type Package Type Package Package bmeta January 8, 2016 Title Bayesian Meta-Analysis and Meta-Regression Version 0.1.2 Date 2016-01-08 Author Tao Ding, Gianluca Baio Maintainer Gianluca Baio

More information

Linear Modeling with Bayesian Statistics

Linear Modeling with Bayesian Statistics Linear Modeling with Bayesian Statistics Bayesian Approach I I I I I Estimate probability of a parameter State degree of believe in specific parameter values Evaluate probability of hypothesis given the

More information

Package pcnetmeta. R topics documented: November 7, 2017

Package pcnetmeta. R topics documented: November 7, 2017 Type Package Title Patient-Centered Network Meta-Analysis Version 2.6 Date 2017-11-07 Author Lifeng Lin, Jing Zhang, and Haitao Chu Maintainer Lifeng Lin Depends R (>= 2.14.0), rjags

More information

An Introduction to Using WinBUGS for Cost-Effectiveness Analyses in Health Economics

An Introduction to Using WinBUGS for Cost-Effectiveness Analyses in Health Economics Practical 1: Getting started in OpenBUGS Slide 1 An Introduction to Using WinBUGS for Cost-Effectiveness Analyses in Health Economics Dr. Christian Asseburg Centre for Health Economics Practical 1 Getting

More information

Bayesian inference for psychology, part III: Parameter estimation in nonstandard models

Bayesian inference for psychology, part III: Parameter estimation in nonstandard models Psychon Bull Rev (2018) 25:77 101 https://doi.org/10.3758/s13423-017-1394-5 Bayesian inference for psychology, part III: Parameter estimation in nonstandard models Dora Matzke 1 Udo Boehm 2 Joachim Vandekerckhove

More information

Markov Chain Monte Carlo (part 1)

Markov Chain Monte Carlo (part 1) Markov Chain Monte Carlo (part 1) Edps 590BAY Carolyn J. Anderson Department of Educational Psychology c Board of Trustees, University of Illinois Spring 2018 Depending on the book that you select for

More information

Package ggmcmc. August 29, 2016

Package ggmcmc. August 29, 2016 Package ggmcmc August 29, 2016 Title Tools for Analyzing MCMC Simulations from Bayesian Inference Tools for assessing and diagnosing convergence of Markov Chain Monte Carlo simulations, as well as for

More information

Package BayesMetaSeq

Package BayesMetaSeq Type Package Package BayesMetaSeq October 20, 2016 Title Bayesian hierarchical model for RNA-seq differential meta-analysis and biomarker categorization Version 2.0 Date 2016-10-20 Author Tianzhou Ma Maintainer

More information

Package BayesMetaSeq

Package BayesMetaSeq Type Package Package BayesMetaSeq March 19, 2016 Title Bayesian hierarchical model for RNA-seq differential meta-analysis Version 1.0 Date 2016-01-29 Author Tianzhou Ma, George Tseng Maintainer Tianzhou

More information

Package HDInterval. June 9, 2018

Package HDInterval. June 9, 2018 Type Package Title Highest (Posterior) Density Intervals Version 0.2.0 Date 2018-06-09 Suggests coda Author Mike Meredith and John Kruschke Package HDInterval June 9, 2018 Maintainer Mike Meredith

More information

Package dclone. February 26, Type Package

Package dclone. February 26, Type Package Type Package Package dclone February 26, 2018 Title Data Cloning and MCMC Tools for Maximum Likelihood Methods Version 2.2-0 Date 2018-02-26 Author Peter Solymos Maintainer Peter Solymos

More information

Package mgsa. January 13, 2019

Package mgsa. January 13, 2019 Version 1.31.0 Date 2017-04-28 Title Model-based gene set analysis Package mgsa January 13, 2019 Author Sebastian Bauer , Julien Gagneur Maintainer

More information

The GLMMGibbs Package

The GLMMGibbs Package The GLMMGibbs Package April 22, 2002 Version 0.5-1 Author Jonathan Myles and David Clayton Maintainer Jonathan Myles Depends R (>= 1.0) Date 2001/22/01 Title

More information

Parameterization Issues and Diagnostics in MCMC

Parameterization Issues and Diagnostics in MCMC Parameterization Issues and Diagnostics in MCMC Gill Chapter 10 & 12 November 10, 2008 Convergence to Posterior Distribution Theory tells us that if we run the Gibbs sampler long enough the samples we

More information

Package bsam. July 1, 2017

Package bsam. July 1, 2017 Type Package Package bsam July 1, 2017 Title Bayesian State-Space Models for Animal Movement Version 1.1.2 Depends R (>= 3.3.0), rjags (>= 4-6) Imports coda (>= 0.18-1), dplyr (>= 0.5.0), ggplot2 (>= 2.1.0),

More information

Replication Note for A Bayesian Poisson Vector Autoregression Model

Replication Note for A Bayesian Poisson Vector Autoregression Model Replication Note for A Bayesian Poisson Vector Autoregression Model Patrick T. Brandt pbrandt@utdallas.edu Todd Sandler tsandler@utdallas.edu School of Economic, Political and Policy Sciences The University

More information

Case Study IV: Bayesian clustering of Alzheimer patients

Case Study IV: Bayesian clustering of Alzheimer patients Case Study IV: Bayesian clustering of Alzheimer patients Mike Wiper and Conchi Ausín Department of Statistics Universidad Carlos III de Madrid Advanced Statistics and Data Mining Summer School 2nd - 6th

More information

Assignment 01. You will understand Kruschke's text much better if you do the computing that is described in his book. Try it out!

Assignment 01. You will understand Kruschke's text much better if you do the computing that is described in his book. Try it out! January 4, 2017 File = D:\P548\assgn01.p548.w17.docm 1 John Miyamoto (email: jmiyamot@uw.edu) Psych 548: Bayesian Statistics, Modeling & Reasoning Winter 2017 Course website: http://faculty.washington.edu/jmiyamot/p548/p548-set.htm

More information

Issues in MCMC use for Bayesian model fitting. Practical Considerations for WinBUGS Users

Issues in MCMC use for Bayesian model fitting. Practical Considerations for WinBUGS Users Practical Considerations for WinBUGS Users Kate Cowles, Ph.D. Department of Statistics and Actuarial Science University of Iowa 22S:138 Lecture 12 Oct. 3, 2003 Issues in MCMC use for Bayesian model fitting

More information

Package boral. R topics documented: May 16, 2018

Package boral. R topics documented: May 16, 2018 Package boral May 16, 2018 Title Bayesian Ordination and Regression AnaLysis Version 1.6.1 Date 2018-06-30 Author Francis K.C. Hui , with contributions from Wade Blanchard

More information

Package sparsereg. R topics documented: March 10, Type Package

Package sparsereg. R topics documented: March 10, Type Package Type Package Package sparsereg March 10, 2016 Title Sparse Bayesian Models for Regression, Subgroup Analysis, and Panel Data Version 1.2 Date 2016-03-01 Author Marc Ratkovic and Dustin Tingley Maintainer

More information

Package Bergm. R topics documented: September 25, Type Package

Package Bergm. R topics documented: September 25, Type Package Type Package Package Bergm September 25, 2018 Title Bayesian Exponential Random Graph Models Version 4.2.0 Date 2018-09-25 Author Alberto Caimo [aut, cre], Lampros Bouranis [aut], Robert Krause [aut] Nial

More information

Package BAMBI. R topics documented: August 28, 2017

Package BAMBI. R topics documented: August 28, 2017 Type Package Title Bivariate Angular Mixture Models Version 1.1.1 Date 2017-08-23 Author Saptarshi Chakraborty, Samuel W.K. Wong Package BAMBI August 28, 2017 Maintainer Saptarshi Chakraborty

More information

Package TreeBUGS. December 18, 2018

Package TreeBUGS. December 18, 2018 Version 1.4.1 Date 2018-12-18 Package TreeBUGS December 18, 2018 Title Hierarchical Multinomial Processing Tree Modeling Author Daniel W. Heck [aut, cre], Nina R. Arnold [aut, dtc], Denis Arnold [aut],

More information

CS281 Section 9: Graph Models and Practical MCMC

CS281 Section 9: Graph Models and Practical MCMC CS281 Section 9: Graph Models and Practical MCMC Scott Linderman November 11, 213 Now that we have a few MCMC inference algorithms in our toolbox, let s try them out on some random graph models. Graphs

More information

Package TBSSurvival. January 5, 2017

Package TBSSurvival. January 5, 2017 Version 1.3 Date 2017-01-05 Package TBSSurvival January 5, 2017 Title Survival Analysis using a Transform-Both-Sides Model Author Adriano Polpo , Cassio de Campos , D.

More information

Stata goes BUGS (via R)

Stata goes BUGS (via R) (via R) Department of Political Science I University of Mannheim 31. March 2006 4th German Stata Users Group press ctrl + l to start presentation Problem 1 Problem You are a Stata user... and have a complicated

More information

ENGR 1181 MATLAB 09: For Loops 2

ENGR 1181 MATLAB 09: For Loops 2 ENGR 1181 MATLAB 09: For Loops Learning Objectives 1. Use more complex ways of setting the loop index. Construct nested loops in the following situations: a. For use with two dimensional arrays b. For

More information

Package TBSSurvival. July 1, 2012

Package TBSSurvival. July 1, 2012 Package TBSSurvival July 1, 2012 Version 1.0 Date 2012-06-30 Title TBS Model R package Author Adriano Polpo , Cassio de Campos , D. Sinha , Stuart

More information

Introduction to WinBUGS

Introduction to WinBUGS Introduction to WinBUGS Joon Jin Song Department of Statistics Texas A&M University Introduction: BUGS BUGS: Bayesian inference Using Gibbs Sampling Bayesian Analysis of Complex Statistical Models using

More information

Package clusternomics

Package clusternomics Type Package Package clusternomics March 14, 2017 Title Integrative Clustering for Heterogeneous Biomedical Datasets Version 0.1.1 Author Evelina Gabasova Maintainer Evelina Gabasova

More information

Package CNVrd2. March 18, 2019

Package CNVrd2. March 18, 2019 Type Package Package CNVrd2 March 18, 2019 Title CNVrd2: a read depth-based method to detect and genotype complex common copy number variants from next generation sequencing data. Version 1.20.0 Date 2014-10-04

More information

RJaCGH, a package for analysis of

RJaCGH, a package for analysis of RJaCGH, a package for analysis of CGH arrays with Reversible Jump MCMC 1. CGH Arrays: Biological problem: Changes in number of DNA copies are associated to cancer activity. Microarray technology: Oscar

More information

Bayesian data analysis using R

Bayesian data analysis using R Bayesian data analysis using R BAYESIAN DATA ANALYSIS USING R Jouni Kerman, Samantha Cook, and Andrew Gelman Introduction Bayesian data analysis includes but is not limited to Bayesian inference (Gelman

More information

G-PhoCS Generalized Phylogenetic Coalescent Sampler version 1.2.3

G-PhoCS Generalized Phylogenetic Coalescent Sampler version 1.2.3 G-PhoCS Generalized Phylogenetic Coalescent Sampler version 1.2.3 Contents 1. About G-PhoCS 2. Download and Install 3. Overview of G-PhoCS analysis: input and output 4. The sequence file 5. The control

More information

Package BTSPAS. R topics documented: February 19, Version Date Title Bayesian Time-Strat. Population Analysis

Package BTSPAS. R topics documented: February 19, Version Date Title Bayesian Time-Strat. Population Analysis Version 2014.0901 Date 2014-09-01 Title Bayesian Time-Strat. Population Analysis Package BTSPAS February 19, 2015 Author Carl J Schwarz and Simon J Bonner

More information

Package HKprocess. R topics documented: September 6, Type Package. Title Hurst-Kolmogorov process. Version

Package HKprocess. R topics documented: September 6, Type Package. Title Hurst-Kolmogorov process. Version Package HKprocess September 6, 2014 Type Package Title Hurst-Kolmogorov process Version 0.0-1 Date 2014-09-06 Author Maintainer Imports MCMCpack (>= 1.3-3), gtools(>= 3.4.1) Depends

More information

Package EMC. February 19, 2015

Package EMC. February 19, 2015 Package EMC February 19, 2015 Type Package Title Evolutionary Monte Carlo (EMC) algorithm Version 1.3 Date 2011-12-08 Author Gopi Goswami Maintainer Gopi Goswami

More information

Package tuts. June 12, 2018

Package tuts. June 12, 2018 Type Package Title Time Uncertain Time Series Analysis Version 0.1.1 Date 2018-06-12 Package tuts June 12, 2018 Models of time-uncertain time series addressing frequency and nonfrequency behavior of continuous

More information

MCMC Diagnostics. Yingbo Li MATH Clemson University. Yingbo Li (Clemson) MCMC Diagnostics MATH / 24

MCMC Diagnostics. Yingbo Li MATH Clemson University. Yingbo Li (Clemson) MCMC Diagnostics MATH / 24 MCMC Diagnostics Yingbo Li Clemson University MATH 9810 Yingbo Li (Clemson) MCMC Diagnostics MATH 9810 1 / 24 Convergence to Posterior Distribution Theory proves that if a Gibbs sampler iterates enough,

More information

Package beast. March 16, 2018

Package beast. March 16, 2018 Type Package Package beast March 16, 2018 Title Bayesian Estimation of Change-Points in the Slope of Multivariate Time-Series Version 1.1 Date 2018-03-16 Author Maintainer Assume that

More information

GLM Poisson Chris Parrish August 18, 2016

GLM Poisson Chris Parrish August 18, 2016 GLM Poisson Chris Parrish August 18, 2016 Contents 3. Introduction to the generalized linear model (GLM) 1 3.3. Poisson GLM in R and WinBUGS for modeling time series of counts 1 3.3.1. Generation and analysis

More information

BART::wbart: BART for Numeric Outcomes

BART::wbart: BART for Numeric Outcomes BART::wbart: BART for Numeric Outcomes Robert McCulloch and Rodney Sparapani Contents 1 BART 1 1.1 Boston Housing Data......................................... 2 1.2 A Quick Look at the Data......................................

More information

Package bacon. October 31, 2018

Package bacon. October 31, 2018 Type Package Package October 31, 2018 Title Controlling bias and inflation in association studies using the empirical null distribution Version 1.10.0 Author Maarten van Iterson [aut, cre], Erik van Zwet

More information

BUCKy Bayesian Untangling of Concordance Knots (applied to yeast and other organisms)

BUCKy Bayesian Untangling of Concordance Knots (applied to yeast and other organisms) Introduction BUCKy Bayesian Untangling of Concordance Knots (applied to yeast and other organisms) Version 1.2, 17 January 2008 Copyright c 2008 by Bret Larget Last updated: 11 November 2008 Departments

More information

Before beginning a session, be sure these packages are loaded using the library() or require() commands.

Before beginning a session, be sure these packages are loaded using the library() or require() commands. Instructions for running state-space movement models in WinBUGS via R. This readme file is included with a package of R and WinBUGS scripts included as an online supplement (Ecological Archives EXXX-XXX-03)

More information

From Bayesian Analysis of Item Response Theory Models Using SAS. Full book available for purchase here.

From Bayesian Analysis of Item Response Theory Models Using SAS. Full book available for purchase here. From Bayesian Analysis of Item Response Theory Models Using SAS. Full book available for purchase here. Contents About this Book...ix About the Authors... xiii Acknowledgments... xv Chapter 1: Item Response

More information

BAYESIAN OUTPUT ANALYSIS PROGRAM (BOA) VERSION 1.0 USER S MANUAL

BAYESIAN OUTPUT ANALYSIS PROGRAM (BOA) VERSION 1.0 USER S MANUAL BAYESIAN OUTPUT ANALYSIS PROGRAM (BOA) VERSION 1.0 USER S MANUAL Brian J. Smith January 8, 2003 Contents 1 Getting Started 4 1.1 Hardware/Software Requirements.................... 4 1.2 Obtaining BOA..............................

More information

Logistic Regression. (Dichotomous predicted variable) Tim Frasier

Logistic Regression. (Dichotomous predicted variable) Tim Frasier Logistic Regression (Dichotomous predicted variable) Tim Frasier Copyright Tim Frasier This work is licensed under the Creative Commons Attribution 4.0 International license. Click here for more information.

More information

YEVHEN YANKOVSKYY. Specialist, Ukrainian Marine State Technical University, 1999 M.A., Kyiv-Mohyla Academy, 2003 M.S., Iowa State University, 2006

YEVHEN YANKOVSKYY. Specialist, Ukrainian Marine State Technical University, 1999 M.A., Kyiv-Mohyla Academy, 2003 M.S., Iowa State University, 2006 APPLICATION OF A GIBBS SAMPLER TO ESTIMATING PARAMETERS OF A HIERARCHICAL NORMAL MODEL WITH A TIME TREND AND TESTING FOR EXISTENCE OF THE GLOBAL WARMING by YEVHEN YANKOVSKYY Specialist, Ukrainian Marine

More information

Package CausalImpact

Package CausalImpact Package CausalImpact September 15, 2017 Title Inferring Causal Effects using Bayesian Structural Time-Series Models Date 2017-08-16 Author Kay H. Brodersen , Alain Hauser

More information

Package SSLASSO. August 28, 2018

Package SSLASSO. August 28, 2018 Package SSLASSO August 28, 2018 Version 1.2-1 Date 2018-08-28 Title The Spike-and-Slab LASSO Author Veronika Rockova [aut,cre], Gemma Moran [aut] Maintainer Gemma Moran Description

More information

Package LCMCR. R topics documented: July 8, 2017

Package LCMCR. R topics documented: July 8, 2017 Package LCMCR July 8, 2017 Type Package Title Bayesian Non-Parametric Latent-Class Capture-Recapture Version 0.4.3 Date 2017-07-07 Author Daniel Manrique-Vallier Bayesian population size estimation using

More information

Package nltt. October 12, 2016

Package nltt. October 12, 2016 Type Package Title Calculate the NLTT Statistic Version 1.3.1 Package nltt October 12, 2016 Provides functions to calculate the normalised Lineage-Through- Time (nltt) statistic, given two phylogenetic

More information

PRINCIPLES OF PHYLOGENETICS Spring 2008 Updated by Nick Matzke. Lab 11: MrBayes Lab

PRINCIPLES OF PHYLOGENETICS Spring 2008 Updated by Nick Matzke. Lab 11: MrBayes Lab Integrative Biology 200A University of California, Berkeley PRINCIPLES OF PHYLOGENETICS Spring 2008 Updated by Nick Matzke Lab 11: MrBayes Lab Note: try downloading and installing MrBayes on your own laptop,

More information

The boa Package. May 3, 2005

The boa Package. May 3, 2005 The boa Package May 3, 2005 Version 1.1.5-2 Date 2005-05-02 Title Bayesian Output Analysis Program (BOA) for MCMC Author Maintainer Depends R (>= 1.7) A menu-driven program and

More information

STAT 540 Computing in Statistics

STAT 540 Computing in Statistics STAT 540 Computing in Statistics Introduces programming skills in two important statistical computer languages/packages. 30-40% R and 60-70% SAS Examples of Programming Skills: 1. Importing Data from External

More information

Debugging MCMC Code. Charles J. Geyer. April 15, 2017

Debugging MCMC Code. Charles J. Geyer. April 15, 2017 Debugging MCMC Code Charles J. Geyer April 15, 2017 1 Introduction This document discusses debugging Markov chain Monte Carlo code using the R contributed package mcmc (Version 0.9-5) for examples. It

More information

Overview. Monte Carlo Methods. Statistics & Bayesian Inference Lecture 3. Situation At End Of Last Week

Overview. Monte Carlo Methods. Statistics & Bayesian Inference Lecture 3. Situation At End Of Last Week Statistics & Bayesian Inference Lecture 3 Joe Zuntz Overview Overview & Motivation Metropolis Hastings Monte Carlo Methods Importance sampling Direct sampling Gibbs sampling Monte-Carlo Markov Chains Emcee

More information

Documentation for BayesAss 1.3

Documentation for BayesAss 1.3 Documentation for BayesAss 1.3 Program Description BayesAss is a program that estimates recent migration rates between populations using MCMC. It also estimates each individual s immigrant ancestry, the

More information

Package sgmcmc. September 26, Type Package

Package sgmcmc. September 26, Type Package Type Package Package sgmcmc September 26, 2017 Title Stochastic Gradient Markov Chain Monte Carlo Version 0.2.0 Provides functions that performs popular stochastic gradient Markov chain Monte Carlo (SGMCMC)

More information

[davinci]$ export CLASSPATH=$CLASSPATH:path_to_file/DualBrothers.jar:path_to_file/colt.jar

[davinci]$ export CLASSPATH=$CLASSPATH:path_to_file/DualBrothers.jar:path_to_file/colt.jar 1 Installing the software 1.1 Java compiler and necessary class libraries The DualBrothers package is distributed as a Java JAR file (DualBrothers.jar). In order to use the package, a Java virtual machine

More information

1. Start WinBUGS by double clicking on the WinBUGS icon (or double click on the file WinBUGS14.exe in the WinBUGS14 directory in C:\Program Files).

1. Start WinBUGS by double clicking on the WinBUGS icon (or double click on the file WinBUGS14.exe in the WinBUGS14 directory in C:\Program Files). Hints on using WinBUGS 1 Running a model in WinBUGS 1. Start WinBUGS by double clicking on the WinBUGS icon (or double click on the file WinBUGS14.exe in the WinBUGS14 directory in C:\Program Files). 2.

More information

VMCMC: a graphical and statistical analysis tool for Markov chain Monte Carlo traces in Bayesian phylogeny

VMCMC: a graphical and statistical analysis tool for Markov chain Monte Carlo traces in Bayesian phylogeny VMCMC: a graphical and statistical analysis tool for Markov chain Monte Carlo traces in Bayesian phylogeny Tutorial version 1.0 Last updated by Raja Hashim Ali on 6 Nov 2015. 1/25 Contents 1 INTRODUCTION

More information

A Short History of Markov Chain Monte Carlo

A Short History of Markov Chain Monte Carlo A Short History of Markov Chain Monte Carlo Christian Robert and George Casella 2010 Introduction Lack of computing machinery, or background on Markov chains, or hesitation to trust in the practicality

More information

Thermo Scientific. Centri-Log V1.0. Operating Manual November 2010

Thermo Scientific. Centri-Log V1.0. Operating Manual November 2010 Thermo Scientific Centri-Log V1.0 Operating Manual 50127006-1 November 2010 2010 Thermo Fisher Scientific Inc. All rights reserved. RC 3BP+ TM, RC 12BP+ TM and RC BIOS are either registered trademarks

More information

The glmmml Package. August 20, 2006

The glmmml Package. August 20, 2006 The glmmml Package August 20, 2006 Version 0.65-1 Date 2006/08/20 Title Generalized linear models with clustering A Maximum Likelihood and bootstrap approach to mixed models. License GPL version 2 or newer.

More information

An Introduction to Markov Chain Monte Carlo

An Introduction to Markov Chain Monte Carlo An Introduction to Markov Chain Monte Carlo Markov Chain Monte Carlo (MCMC) refers to a suite of processes for simulating a posterior distribution based on a random (ie. monte carlo) process. In other

More information

Package SparseFactorAnalysis

Package SparseFactorAnalysis Type Package Package SparseFactorAnalysis July 23, 2015 Title Scaling Count and Binary Data with Sparse Factor Analysis Version 1.0 Date 2015-07-20 Author Marc Ratkovic, In Song Kim, John Londregan, and

More information

Package MfUSampler. June 13, 2017

Package MfUSampler. June 13, 2017 Package MfUSampler June 13, 2017 Type Package Title Multivariate-from-Univariate (MfU) MCMC Sampler Version 1.0.4 Date 2017-06-09 Author Alireza S. Mahani, Mansour T.A. Sharabiani Maintainer Alireza S.

More information

Package mfa. R topics documented: July 11, 2018

Package mfa. R topics documented: July 11, 2018 Package mfa July 11, 2018 Title Bayesian hierarchical mixture of factor analyzers for modelling genomic bifurcations Version 1.2.0 MFA models genomic bifurcations using a Bayesian hierarchical mixture

More information

Tutorial using BEAST v2.4.1 Troubleshooting David A. Rasmussen

Tutorial using BEAST v2.4.1 Troubleshooting David A. Rasmussen Tutorial using BEAST v2.4.1 Troubleshooting David A. Rasmussen 1 Background The primary goal of most phylogenetic analyses in BEAST is to infer the posterior distribution of trees and associated model

More information

You are free to use this program, for non-commercial purposes only, under two conditions:

You are free to use this program, for non-commercial purposes only, under two conditions: Bayesian sample size determination for prevalence and diagnostic studies in the absence of a gold standard Sample size calculations and asymptotic results (Version 5.10, June 2016) 1. Introduction The

More information

Journal of Statistical Software

Journal of Statistical Software JSS Journal of Statistical Software December 2007, Volume 23, Issue 9. http://www.jstatsoft.org/ WinBUGSio: A SAS Macro for the Remote Execution of WinBUGS Michael K. Smith Pfizer Global Research and Development

More information

PIANOS requirements specifications

PIANOS requirements specifications PIANOS requirements specifications Group Linja Helsinki 7th September 2005 Software Engineering Project UNIVERSITY OF HELSINKI Department of Computer Science Course 581260 Software Engineering Project

More information

Applied Bayesian Modeling Using JAGS and BUGS via R

Applied Bayesian Modeling Using JAGS and BUGS via R Applied Bayesian Modeling Using JAGS and BUGS via R Johannes Karreth Ursinus College jkarreth@ursinus.edu ICPSR Summer Program 2017 All code used in this tutorial can also be found on my github page at

More information

Package bayescl. April 14, 2017

Package bayescl. April 14, 2017 Package bayescl April 14, 2017 Version 0.0.1 Date 2017-04-10 Title Bayesian Inference on a GPU using OpenCL Author Rok Cesnovar, Erik Strumbelj Maintainer Rok Cesnovar Description

More information