An Introduction to StatJR

Slides:



Advertisements
Similar presentations
Progress on the software developed under E-STAT Bill Browne and Chris Charlton.
Advertisements

Lecture 9 Model Comparison using MCMC and further models.
Other MCMC features in MLwiN and the MLwiN->WinBUGS interface
NCeSS e-Stat quantitative node Prof. William Browne & Prof. Jon Rasbash University of Bristol.
For the e-Stat meeting of 6-7 April 2011 Paul Lambert / DAMES Node inputs 1)Updates on DAMES 2)Bringing DAMES inputs to e-Stat 3)Misc. feedback - Stat-JR.
Applied Econometrics Second edition
10 Software Engineering Foundations of Computer Science ã Cengage Learning.
Stat-JR: eBooks Richard Parker. Quick overview To recap… Stat-JR uses templates to perform specific functions on datasets, e.g.: – 1LevelMod fits 1-level.
Professor William Browne and Chris Charlton Centre for Multilevel Modelling Progress with STAT-JR April 2011 – September 2011.
Calendar Browser is a groupware used for booking all kinds of resources within an organization. Calendar Browser is installed on a file server and in a.
The use of electronic books (eBooks) in social science research Richard Parker* Danius Michaelides† Huanji Yang† Alex Frazer† Luc Moreau† Camille Szmaragd*
Visual Basic 2010 How to Program. © by Pearson Education, Inc. All Rights Reserved.2.
Visual Basic 2010 How to Program Reference: Instructor: Maysoon Bin Duwais slides Visual Basic 2010 how to program by Deitel © by Pearson Education,
William Browne §, Laura Green*, Graham Medley* and Camille Szmaragd § §University of Bristol *University of Warwick Using Discrete time survival models.
Chapter 3 Planning Your Solution
By Hrishikesh Gadre Session I Introduction to EES Department of Mechanical Engineering Louisiana State University Engineering Equation.
Department of Geography, Florida State University
1 Cost Estimation CIS 375 Bruce R. Maxim UM-Dearborn.
DEMONSTRATION FOR SIGMA DATA ACQUISITION MODULES Tempatron Ltd Data Measurements Division Darwin Close Reading RG2 0TB UK T : +44 (0) F :
The Project AH Computing. Functional Requirements  What the product must do!  Examples attractive welcome screen all options available as clickable.
Automating Practice Partner with Macro Express Donald T. Stewart, MD 2007User Group Meeting.
CASE Tools And Their Effect On Software Quality Peter Geddis – pxg07u.
LEMMA: Learning Environment in Multilevel Modelling and Applications Fiona Steele London School of Economics & Political Science Director NCRM LEMMA node,
Professor William Browne School of Veterinary Science and Centre for Multilevel Modelling Statistical Software at the Centre for Multilevel Modelling (In.
Introducing the STAT-JR software package Professor William Browne, School of Veterinary Science, University of Bristol.
1 iSee Player Tutorial Using the Forest Biomass Accumulation Model as an Example ( Tutorial Developed by: (
An introduction to R: get familiar with R Guangxu Liu Bio7932.
Introduction to MCMC and BUGS. Computational problems More parameters -> even more parameter combinations Exact computation and grid approximation become.
StAR web server tutorial for ROC Analysis. ROC Analysis ROC Analysis: This module allows the user to input data for several classifiers to be tested.
Introduction of Geoprocessing Topic 7a 4/10/2007.
Copyright OpenHelix. No use or reproduction without express written consent1.
An Introduction to Designing and Executing Workflows with Taverna Aleksandra Pawlik materials by: Katy Wolstencroft University of Manchester.
Multilevel Modeling Software Wayne Osgood Crime, Law & Justice Program Department of Sociology.
GeoGebra: Free Dynamic Software for Geometry and Beyond Shelley W. Question to ponder:
240-Current Research Easily Extensible Systems, Octave, Input Formats, SOA.
Graphical User Interface You will be used to using programs that have a graphical user interface (GUI). So far you have been writing programs that have.
The Software Development Process
Introduction of Geoprocessing Lecture 9 3/24/2008.
Downloading the MAXENT Software
Introduction to Eviews Eviews Workshop September 6, :30 p.m.-3:30 p.m.
Learning Objectives Understand the basic concepts and principles of Revit Architecture Understand different terms used in Revit Architecture. Understand.
Bursts modelling Using WinBUGS Tim Watson May 2012 :diagnostics/ :transformation/ :investment planning/ :portfolio optimisation/ :investment economics/
What are Statistical E-Books? Professor William Browne Centre for Multilevel Modelling, University of Bristol.
Dive Into® Visual Basic 2010 Express
Chapter 13 Simple Linear Regression
Development Environment
Chris Gavanas 31/08/2016 Summer Student Report.
Learning Objectives •Understand the basic concepts and principles of Revit Architecture • Understand different terms used in Revit Architecture.
IET 603 Minitab Chapter 12 Christopher Smith
Learning to Program D is for Digital.
IBM Rational Rhapsody Advanced Systems Training v7.5
Loops BIS1523 – Lecture 10.
Matlab Training Session 4: Control, Flow and Functions
GO! with Microsoft Office 2016
Introduction to Ms-Access Submitted By- Navjot Kaur Mahi
Workflows with ENVI and Esri Agriculture workflows for ICARDA
School of Mathematical Sciences, University of Nottingham.
More Selections BIS1523 – Lecture 9.
James Blankenship March , 2018
Centre for Multilevel Modelling, University of Bristol
Evolve What is a Component?
Loops CIS 40 – Introduction to Programming in Python
Professor William Browne,
Coding Concepts (Basics)
Teaching slides Chapter 6.
Topics Introduction to Value-returning Functions: Generating Random Numbers Writing Your Own Value-Returning Functions The math Module Storing Functions.
Overview of Contract Association Batch Upload
HP Quality Center 10.0 The Test Plan Module
Matthew Sciclunaa, Soaleha Shamsb, & Robert Gerlaib,c
Professor William Browne,
Presentation transcript:

An Introduction to StatJR Professor William Browne, Centre for Multilevel Modelling,University of Bristol

Acknowledgements Jon Rasbash for his vision on which Stat-JR was built. All the team behind programming the Stat-JR software – Chris, Danius, Luc, ZZ, Richard, Camille, Bruce, Huanjia and Alex and collaborators on the e-Stat project. Harvey Goldstein, Fiona Steele, George Leckie, Chris Charlton, Kelvyn Jones, Liz Washbrook and all my other CMM colleagues past and present. Ian for being a pioneering StatJR user. ESRC for much funding over the years! British Academy for funding the teaching eBook work (see Liz’s talk)!

What will we cover ? Introduction to StatJR. Interoperability with other packages. The use of StatJR for new models. (Ian) StatJR’s eBook and workflow interfaces. The use of StatJR to automate modelling. (me) The use of StatJR to automate teaching material generation. (Liz)

Background to CMM Cross-faculty statistical research group primarily based in Education where we are a research centre. Existed since at least the 1990s when based at the IOE in London! Produce statistical software packages, MLwiN and StatJR with over 15,000 users. Also LEMMA online training materials with nearly 20,000 users. Research funded by the ESRC via several programme nodes to a total of more than £5M in the past 10 years or so See http://www.bristol.ac.uk/cmm/

Stat-JR - Jon Rasbash’s big vision Following work on MLwiN, Jon had been thinking hard on where our software went next. The frequentist IGLS algorithm was hard to extend further. WinBUGS showed that MCMC as an algorithm could be extended easily but the difficulty in MLwiN was in extending my MCMC code! The big vision was an all-singing all-dancing system where expert users could add functionality easily and which interoperates with other software. Bruce Cameron was developing an underpinning algebra system. The ESRC LEMMA II, LEMMA III and eSTAT grants would enable this to be achieved

STAT-JR component based approach Below is an early diagram of how we envisioned the system. Here you will see boxes representing components some of which are built into the STAT-JR system. The system is written in Python with a VB.net algebra processing system. A team of coders have worked together on the system.

Templates Backbone of Stat-JR. Consist of a set of code sections for advanced users to write. A bit like R packages. For a model template it consists of at least: an inputs method which specifies inputs and types A model method that creates (BUGS like) model code for the algebra system An (optional) latex method can be used for outputting LaTeX code for the model. Other optional functions required for more complex templates

Regression 1 Example from EStat.Templating import * model = ''' model{ for (i in 1:length(${y})) { ${y}[i] ~ dnorm(mu[i], tau) mu[i] <- ${mmult(x, 'beta', 'i')} } # Priors % for i in range(0, x.ncols()): beta${i} ~ dflat() % endfor tau ~ dgamma(0.001000, 0.001000) sigma2 <- 1 / tau sigma <- 1 / sqrt(tau) ''' latex = r''' \begin{aligned} \mbox{${y}}_i & \sim \mbox{N}(\mu_i, \sigma^2) \\ \mu_i & = ${mmulttex(x, r'\beta', 'i')} \\ %for i in range(0, len(x)): \beta_${i} & \propto 1 \\ %endfor \tau & \sim \Gamma (0.001,0.001) \\ \sigma^2 & = 1 / \tau \end{aligned} from EStat.Templating import * class Regression1(Template): 'A model template for fitting 1 level Normal multiple regression model in eStat only.‘ tags = [ 'Model', '1-Level', 'eStat', 'Normal' ] engines = ['eStat'] inputs = ''' y = DataVector('Response: ') x = DataMatrix('Explanatory variables: ', allow_cat=True, help= 'predictor variables') beta = ParamVector(parents=[x], as_scalar=True) tau = ParamScalar() sigma = ParamScalar(modelled = False) sigma2 = ParamScalar(modelled = False) deviance = ParamScalar(modelled = False) '''

An example of STAT-JR – setting up a model

An example of STAT-JR – setting up a model

Equations for model All objects created available from one pull down and can be popped out to separate tabs in browser.

Equations for model Note: Equations use MATHJAX and so underlying LaTeX can be copied and paste. The model code is based around the WinBUGS language with some variation.

Model code All objects created available from one pull down and can be popped out to separate tabs in browser.

Model code in detail model{ for (i in 1:length(normexam)) { normexam[i] ~ dnorm(mu[i], tau) mu[i] <- cons[i] * beta0 + standlrt[i] * beta1 } # Priors beta0 ~ dflat() beta1 ~ dflat() tau ~ dgamma(0.001000, 0.001000) sigma2 <- 1 / tau sigma <- 1/sqrt(tau) For this template the code is, aside from the length function, standard WinBUGS model code.

Algebra system steps

Algebra system steps

Algebra system steps Here the first line is what is returned by the algebra system – which works solely on the model code. The second line is what can be calculated when values are added for constants and data etc. System then constructs C code and fits model

Output of generated C++ code (old screen) The package can output C++ code that can then be taken away by software developers and modified.

Output of generated C++ code (new screen) // Update beta1 { beta1 = dnorm((0.000249799765395*(2382.12631198+(beta0*(-7.34783096611)))),(4003.20632175*tau)); } // Update beta0 beta0 = dnorm((((-0.462375992909)+((-7.34783096611)*beta1))*0.000246366100025),(tau*4059.0)); Note now that the code includes the actual data in place of constants and so looks less like the familiar algebraic expressions

Output from the E-STAT engine Estimates and the DIC diagnostic can be viewed for the model fitted.

Output from the E-STAT engine E-STAT offers multiple chains so that we can use multiple chain diagnostics to aid convergence checking. Otherwise the graphs are borrowed from the MLwiN 6-way plotting. Graphics are in svg format so scale nicely.

Interoperability

Interoperability with WinBUGS (Regression 2) This template offers the choice of many software packages for fitting a regression model. STAT-JR checks what is installed on the machine and only offers packages that are installed. Here we choose WinBUGS. Interoperability in the user interface is obtained via a few extra inputs. In fact in the template code user written functions are required for all packages apart from WinBUGS, OpenBUGS and JAGS. The transfer of data between packages is however generic.

Interoperability with WinBUGS (Regression 2) Here we can view the files required to run WinBUGS in the pane (script file shown but model, inits and data also available) The model can be run by press of a button.

Interoperability with R R can be chosen as another alternative. In fact here we have 2 choices – glm or MCMCglmm. You will see in the pane the script file ready for input to R. There will also be the data file that R requires.

Interoperability with R If written in to the code in the template – graphics from other software can be extracted. Here for example is a residual plot associated with the R fit of the model.

Other templates - XYplot There are also templates for plotting. For example here is a plot using the Xyplot template. Shown is the plot whilst the Python command script is also available.