Git Product home page Git Product logo

matbugs's Introduction

matbugs

A MATLAB interface to WinBugs.

MATBUGS is a Matlab interface for WinBugs and OpenBugs, which are programs for Gibbs sampling applied to hierarchical Bayesian models.

Written by Kevin Murphy and Maryam Mahdaviani, August 2005.

Download matbugs.m is the only file you need. However, there are several demos that show how to use matbugs that are worth downloading too. Just press the 'download ZIP' button on github, or type `git clone https://github.com/matbugs/matbugs.git'.

Usage

Here is a basic example of how to use matbugs:

[samples, stats] = matbugs(dataStruct, modelFileName, 'init', initStructs, 'view', 1, 'nburnin', 1000, 'nsamples', 500, 'thin', 10, 'monitorParams', {'theta', 'mu_theta', 'sigma_theta'}, 'Bugdir', 'C:/Program Files/WinBUGS14');

You can see that optional arguments are passed in the form 'name', value. To use openbugs, pass in the arguments 'openbugs', 1.

It is very important that you initialise the variables (using initStructs) to sensible values - if BUGS samples nodes from a vague prior, they will likely be extreme, and the program will crash!

There are two outputs. |samples| is a structure, containing one field per variable that you have chosen to monitor e.g. samples.theta(c,s) is the value of sample s in chain c. For vectors, use samples.theta(c,s,i) and for matrices, samples.theta(c,s,i,j).

|stats| is a structure containing the mean, variance and EPSR statistic computed over samples for each monitored variable.

Demos

The examples below give more details on how to use the program

schools

birats

<seeds

How it works

Matbugs automatically generates the script file from the model (e.g., see this example script file, calls WinBUGS, reads in the results (using bugs2mat), and then performs simple convergence diagnostics. Thus it provides complete functionality, very similar to R2WinBUGS and bugsR.

Issues on MS Windows systems

If you are using Windows 7 or Windows Vista, make sure you install winbugs in a directory to which you have write permission - don't use 'C:\Program Files\Winbugs14'. I use 'C:\kmurphy\Programs\Winbugs14' and then modify the 'Bugdir' argument when calling matbugs.

matbugs's People

Contributors

murphyk avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.