SlideShare a Scribd company logo
1 of 24
Introduction to the Stat-JR
software package
Professor William Browne
Video 1 What is StatJR
• A statistical software package written in Python and first released
in 2013.
• Named after our former colleague Jon Rasbash and pronounced
“Stature”.
• Stat-JR is meant to appeal to novice users, expert users and
other algorithm developers
• It has its own MCMC estimation engine built into the software but
also allows interoperability with other software packages (this
talk).
• Has several interfaces including an electronic book interface
including “statistical analysis assistant” features (talk 2).
• Can also be used to create “bespoke” training materials in
combination with the SPSS software package (talk 3).
StatJR 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
Examplefrom 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)
'''
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}
'''
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
• The package can output C++ code that can then be
taken away by software developers and modified.
Output of generated C++ code
// 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.
• Graphics are in svg
format so scale
nicely.
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.
• For more details on StatJR go to http://www.bristol.ac.uk/cmm/software/statjr/
Useful websites for further information
• www.understandingsociety.ac.uk (a
‘biosocial’ resource)
• www.closer.ac.uk (UK longitudinal
studies)
• www.ukdataservice.ac.uk (access data)
• www.metadac.ac.uk (genetics data)
• www.ncrm.ac.uk (training and
information)

More Related Content

What's hot

Basic matlab and matrix
Basic matlab and matrixBasic matlab and matrix
Basic matlab and matrixSaidur Rahman
 
Matlab HTI summer training course_Lecture2
Matlab HTI summer training course_Lecture2Matlab HTI summer training course_Lecture2
Matlab HTI summer training course_Lecture2Mohamed Awni
 
Basics of programming in matlab
Basics of programming in matlabBasics of programming in matlab
Basics of programming in matlabAKANKSHA GUPTA
 
Matlab introduction lecture 1
Matlab introduction lecture 1Matlab introduction lecture 1
Matlab introduction lecture 1Mohamed Awni
 
Matlab practical and lab session
Matlab practical and lab sessionMatlab practical and lab session
Matlab practical and lab sessionDr. Krishna Mohbey
 
Matlab Programming Tips Part 1
Matlab Programming Tips Part 1Matlab Programming Tips Part 1
Matlab Programming Tips Part 1Shameer Ahmed Koya
 
Matlab 1(operations on_matrix)
Matlab 1(operations on_matrix)Matlab 1(operations on_matrix)
Matlab 1(operations on_matrix)harman kaur
 
Introduction to MATLAB
Introduction to MATLABIntroduction to MATLAB
Introduction to MATLABRavikiran A
 
B61301007 matlab documentation
B61301007 matlab documentationB61301007 matlab documentation
B61301007 matlab documentationManchireddy Reddy
 
Brief Introduction to Matlab
Brief  Introduction to MatlabBrief  Introduction to Matlab
Brief Introduction to MatlabTariq kanher
 
Image processing with matlab
Image processing with matlabImage processing with matlab
Image processing with matlabminhtaispkt
 
Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlabBilawalBaloch1
 
Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlabTarun Gehlot
 
Matlab for diploma students(1)
Matlab for diploma students(1)Matlab for diploma students(1)
Matlab for diploma students(1)Retheesh Raj
 
MATLAB/SIMULINK for Engineering Applications day 2:Introduction to simulink
MATLAB/SIMULINK for Engineering Applications day 2:Introduction to simulinkMATLAB/SIMULINK for Engineering Applications day 2:Introduction to simulink
MATLAB/SIMULINK for Engineering Applications day 2:Introduction to simulinkreddyprasad reddyvari
 

What's hot (20)

Basic matlab and matrix
Basic matlab and matrixBasic matlab and matrix
Basic matlab and matrix
 
Matlab HTI summer training course_Lecture2
Matlab HTI summer training course_Lecture2Matlab HTI summer training course_Lecture2
Matlab HTI summer training course_Lecture2
 
Basics of programming in matlab
Basics of programming in matlabBasics of programming in matlab
Basics of programming in matlab
 
Matlab introduction lecture 1
Matlab introduction lecture 1Matlab introduction lecture 1
Matlab introduction lecture 1
 
Matlab intro
Matlab introMatlab intro
Matlab intro
 
Matlab Basic Tutorial
Matlab Basic TutorialMatlab Basic Tutorial
Matlab Basic Tutorial
 
Matlab practical and lab session
Matlab practical and lab sessionMatlab practical and lab session
Matlab practical and lab session
 
Matlab Programming Tips Part 1
Matlab Programming Tips Part 1Matlab Programming Tips Part 1
Matlab Programming Tips Part 1
 
MATLAB Programming
MATLAB Programming MATLAB Programming
MATLAB Programming
 
Matlab 1(operations on_matrix)
Matlab 1(operations on_matrix)Matlab 1(operations on_matrix)
Matlab 1(operations on_matrix)
 
Introduction to MATLAB
Introduction to MATLABIntroduction to MATLAB
Introduction to MATLAB
 
B61301007 matlab documentation
B61301007 matlab documentationB61301007 matlab documentation
B61301007 matlab documentation
 
All About MATLAB
All About MATLABAll About MATLAB
All About MATLAB
 
Brief Introduction to Matlab
Brief  Introduction to MatlabBrief  Introduction to Matlab
Brief Introduction to Matlab
 
Matlab dip
Matlab dipMatlab dip
Matlab dip
 
Image processing with matlab
Image processing with matlabImage processing with matlab
Image processing with matlab
 
Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlab
 
Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlab
 
Matlab for diploma students(1)
Matlab for diploma students(1)Matlab for diploma students(1)
Matlab for diploma students(1)
 
MATLAB/SIMULINK for Engineering Applications day 2:Introduction to simulink
MATLAB/SIMULINK for Engineering Applications day 2:Introduction to simulinkMATLAB/SIMULINK for Engineering Applications day 2:Introduction to simulink
MATLAB/SIMULINK for Engineering Applications day 2:Introduction to simulink
 

Similar to Introduction to the Stat-JR software package

Problem-solving and design 1.pptx
Problem-solving and design 1.pptxProblem-solving and design 1.pptx
Problem-solving and design 1.pptxTadiwaMawere
 
AnalyticOps - Chicago PAW 2016
AnalyticOps - Chicago PAW 2016AnalyticOps - Chicago PAW 2016
AnalyticOps - Chicago PAW 2016Robert Grossman
 
Java fundamentals
Java fundamentalsJava fundamentals
Java fundamentalsHCMUTE
 
IRJET-Hardware Co-Simulation of Classical Edge Detection Algorithms using Xil...
IRJET-Hardware Co-Simulation of Classical Edge Detection Algorithms using Xil...IRJET-Hardware Co-Simulation of Classical Edge Detection Algorithms using Xil...
IRJET-Hardware Co-Simulation of Classical Edge Detection Algorithms using Xil...IRJET Journal
 
cscript_controller.pdf
cscript_controller.pdfcscript_controller.pdf
cscript_controller.pdfVcTrn1
 
C++ unit-1-part-11
C++ unit-1-part-11C++ unit-1-part-11
C++ unit-1-part-11Jadavsejal
 
VCE Unit 01 (1).pptx
VCE Unit 01 (1).pptxVCE Unit 01 (1).pptx
VCE Unit 01 (1).pptxskilljiolms
 
An Overview of SystemVerilog for Design and Verification
An Overview of SystemVerilog  for Design and VerificationAn Overview of SystemVerilog  for Design and Verification
An Overview of SystemVerilog for Design and VerificationKapilRaghunandanTrip
 
Intake 38 data access 3
Intake 38 data access 3Intake 38 data access 3
Intake 38 data access 3Mahmoud Ouf
 
R Programming Magrittrdfgdfsgfdgfdgfdgfdsg fsd gdfsgdf gdf gdfsgfd
R Programming  Magrittrdfgdfsgfdgfdgfdgfdsg fsd gdfsgdf gdf gdfsgfdR Programming  Magrittrdfgdfsgfdgfdgfdgfdsg fsd gdfsgdf gdf gdfsgfd
R Programming Magrittrdfgdfsgfdgfdgfdgfdsg fsd gdfsgdf gdf gdfsgfdvaibhavkandalkar2
 
Python programming variables and comment
Python programming variables and commentPython programming variables and comment
Python programming variables and commentMalligaarjunanN
 

Similar to Introduction to the Stat-JR software package (20)

Problem-solving and design 1.pptx
Problem-solving and design 1.pptxProblem-solving and design 1.pptx
Problem-solving and design 1.pptx
 
AnalyticOps - Chicago PAW 2016
AnalyticOps - Chicago PAW 2016AnalyticOps - Chicago PAW 2016
AnalyticOps - Chicago PAW 2016
 
Java fundamentals
Java fundamentalsJava fundamentals
Java fundamentals
 
Vb (1)
Vb (1)Vb (1)
Vb (1)
 
IRJET-Hardware Co-Simulation of Classical Edge Detection Algorithms using Xil...
IRJET-Hardware Co-Simulation of Classical Edge Detection Algorithms using Xil...IRJET-Hardware Co-Simulation of Classical Edge Detection Algorithms using Xil...
IRJET-Hardware Co-Simulation of Classical Edge Detection Algorithms using Xil...
 
Vb net1
Vb net1Vb net1
Vb net1
 
cscript_controller.pdf
cscript_controller.pdfcscript_controller.pdf
cscript_controller.pdf
 
Data Exploration in R.pptx
Data Exploration in R.pptxData Exploration in R.pptx
Data Exploration in R.pptx
 
Base de-datos
Base de-datosBase de-datos
Base de-datos
 
C++ unit-1-part-11
C++ unit-1-part-11C++ unit-1-part-11
C++ unit-1-part-11
 
unit 5-ERTS.pptx
unit 5-ERTS.pptxunit 5-ERTS.pptx
unit 5-ERTS.pptx
 
VCE Unit 01 (1).pptx
VCE Unit 01 (1).pptxVCE Unit 01 (1).pptx
VCE Unit 01 (1).pptx
 
GCF
GCFGCF
GCF
 
An Overview of SystemVerilog for Design and Verification
An Overview of SystemVerilog  for Design and VerificationAn Overview of SystemVerilog  for Design and Verification
An Overview of SystemVerilog for Design and Verification
 
c++ referesher 1.pdf
c++ referesher 1.pdfc++ referesher 1.pdf
c++ referesher 1.pdf
 
Database programming
Database programmingDatabase programming
Database programming
 
Intake 38 data access 3
Intake 38 data access 3Intake 38 data access 3
Intake 38 data access 3
 
R Programming Magrittrdfgdfsgfdgfdgfdgfdsg fsd gdfsgdf gdf gdfsgfd
R Programming  Magrittrdfgdfsgfdgfdgfdgfdsg fsd gdfsgdf gdf gdfsgfdR Programming  Magrittrdfgdfsgfdgfdgfdgfdsg fsd gdfsgdf gdf gdfsgfd
R Programming Magrittrdfgdfsgfdgfdgfdgfdsg fsd gdfsgdf gdf gdfsgfd
 
Matopt
MatoptMatopt
Matopt
 
Python programming variables and comment
Python programming variables and commentPython programming variables and comment
Python programming variables and comment
 

More from University of Southampton

Generating SPSS training materials in StatJR
Generating SPSS training materials in StatJRGenerating SPSS training materials in StatJR
Generating SPSS training materials in StatJRUniversity of Southampton
 
Multi level modelling- random coefficient models | Ian Brunton-Smith
Multi level modelling- random coefficient models | Ian Brunton-SmithMulti level modelling- random coefficient models | Ian Brunton-Smith
Multi level modelling- random coefficient models | Ian Brunton-SmithUniversity of Southampton
 
Multi level modelling - random intercept models | Ian Brunton Smith
Multi level modelling - random intercept models | Ian Brunton SmithMulti level modelling - random intercept models | Ian Brunton Smith
Multi level modelling - random intercept models | Ian Brunton SmithUniversity of Southampton
 
Introduction to multilevel modelling | Ian Brunton-Smith
Introduction to multilevel modelling | Ian Brunton-SmithIntroduction to multilevel modelling | Ian Brunton-Smith
Introduction to multilevel modelling | Ian Brunton-SmithUniversity of Southampton
 
Biosocial research:How to use biological data in social science research?
Biosocial research:How to use biological data in social science research?Biosocial research:How to use biological data in social science research?
Biosocial research:How to use biological data in social science research?University of Southampton
 
Integrating biological and social research data - Michaela Benzeval
Integrating biological and social research data - Michaela BenzevalIntegrating biological and social research data - Michaela Benzeval
Integrating biological and social research data - Michaela BenzevalUniversity of Southampton
 
Teaching research methods: pedagogy of methods learning
Teaching research methods: pedagogy of methods learningTeaching research methods: pedagogy of methods learning
Teaching research methods: pedagogy of methods learningUniversity of Southampton
 
Introduction to spatial interaction modelling
Introduction to spatial interaction modellingIntroduction to spatial interaction modelling
Introduction to spatial interaction modellingUniversity of Southampton
 
Participatory performative and mobile methods
Participatory performative and mobile methodsParticipatory performative and mobile methods
Participatory performative and mobile methodsUniversity of Southampton
 

More from University of Southampton (20)

Introduction to Survey Data Quality
Introduction to Survey Data Quality  Introduction to Survey Data Quality
Introduction to Survey Data Quality
 
Generating SPSS training materials in StatJR
Generating SPSS training materials in StatJRGenerating SPSS training materials in StatJR
Generating SPSS training materials in StatJR
 
Multi level modelling- random coefficient models | Ian Brunton-Smith
Multi level modelling- random coefficient models | Ian Brunton-SmithMulti level modelling- random coefficient models | Ian Brunton-Smith
Multi level modelling- random coefficient models | Ian Brunton-Smith
 
Multi level modelling - random intercept models | Ian Brunton Smith
Multi level modelling - random intercept models | Ian Brunton SmithMulti level modelling - random intercept models | Ian Brunton Smith
Multi level modelling - random intercept models | Ian Brunton Smith
 
Introduction to multilevel modelling | Ian Brunton-Smith
Introduction to multilevel modelling | Ian Brunton-SmithIntroduction to multilevel modelling | Ian Brunton-Smith
Introduction to multilevel modelling | Ian Brunton-Smith
 
Biosocial research:How to use biological data in social science research?
Biosocial research:How to use biological data in social science research?Biosocial research:How to use biological data in social science research?
Biosocial research:How to use biological data in social science research?
 
Integrating biological and social research data - Michaela Benzeval
Integrating biological and social research data - Michaela BenzevalIntegrating biological and social research data - Michaela Benzeval
Integrating biological and social research data - Michaela Benzeval
 
Teaching research methods: pedagogy hooks
Teaching research methods: pedagogy hooksTeaching research methods: pedagogy hooks
Teaching research methods: pedagogy hooks
 
Teaching research methods: pedagogy of methods learning
Teaching research methods: pedagogy of methods learningTeaching research methods: pedagogy of methods learning
Teaching research methods: pedagogy of methods learning
 
Data quality: total survey error
Data quality: total survey errorData quality: total survey error
Data quality: total survey error
 
better off living with parents
better off living with parentsbetter off living with parents
better off living with parents
 
Multilevel models:random coefficient models
Multilevel models:random coefficient modelsMultilevel models:random coefficient models
Multilevel models:random coefficient models
 
Multilevel models:random intercept models
Multilevel models:random intercept modelsMultilevel models:random intercept models
Multilevel models:random intercept models
 
Introduction to multilevel modelling
Introduction to multilevel modellingIntroduction to multilevel modelling
Introduction to multilevel modelling
 
How to write about research methods
How to write about research methodsHow to write about research methods
How to write about research methods
 
How to write about research methods
How to write about research methodsHow to write about research methods
How to write about research methods
 
Introduction to spatial interaction modelling
Introduction to spatial interaction modellingIntroduction to spatial interaction modelling
Introduction to spatial interaction modelling
 
Cognitive interviewing
Cognitive interviewingCognitive interviewing
Cognitive interviewing
 
Survey questions and measurement error
Survey questions and measurement errorSurvey questions and measurement error
Survey questions and measurement error
 
Participatory performative and mobile methods
Participatory performative and mobile methodsParticipatory performative and mobile methods
Participatory performative and mobile methods
 

Recently uploaded

Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfakmcokerachita
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting DataJhengPantaleon
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerunnathinaik
 

Recently uploaded (20)

Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdf
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developer
 

Introduction to the Stat-JR software package

  • 1. Introduction to the Stat-JR software package Professor William Browne
  • 2. Video 1 What is StatJR • A statistical software package written in Python and first released in 2013. • Named after our former colleague Jon Rasbash and pronounced “Stature”. • Stat-JR is meant to appeal to novice users, expert users and other algorithm developers • It has its own MCMC estimation engine built into the software but also allows interoperability with other software packages (this talk). • Has several interfaces including an electronic book interface including “statistical analysis assistant” features (talk 2). • Can also be used to create “bespoke” training materials in combination with the SPSS software package (talk 3).
  • 3. StatJR 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.
  • 4. 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
  • 5. Regression 1 Examplefrom 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) ''' 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} '''
  • 6. An example of STAT-JR – setting up a model
  • 7. An example of STAT-JR – setting up a model
  • 8. Equations for model – All objects created available from one pull down and can be popped out to separate tabs in browser.
  • 9. 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.
  • 10. Model code • All objects created available from one pull down and can be popped out to separate tabs in browser.
  • 11. 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.
  • 14. 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
  • 15. Output of generated C++ code • The package can output C++ code that can then be taken away by software developers and modified.
  • 16. Output of generated C++ code // 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
  • 17. Output from the E-STAT engine – Estimates and the DIC diagnostic can be viewed for the model fitted.
  • 18. Output from the E-STAT engine • E-STAT offers multiple chains so that we can use multiple chain diagnostics to aid convergence checking. • Graphics are in svg format so scale nicely.
  • 19. 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.
  • 20. 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.
  • 21. 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.
  • 22. 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.
  • 23. 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. • For more details on StatJR go to http://www.bristol.ac.uk/cmm/software/statjr/
  • 24. Useful websites for further information • www.understandingsociety.ac.uk (a ‘biosocial’ resource) • www.closer.ac.uk (UK longitudinal studies) • www.ukdataservice.ac.uk (access data) • www.metadac.ac.uk (genetics data) • www.ncrm.ac.uk (training and information)