Stat-JR Advanced User's Guide

Stat-JR Advanced User's Guide

An Advanced User’s Guide to Stat-JR version 1.0.6 Programming and Documentation by William J. Browne*, Christopher M.J. Charlton*, Danius T. Michaelides**, Richard M.A. Parker*, Bruce Cameron*, Camille Szmaragd*, Huanjia Yang**, Zhengzheng Zhang*, Harvey Goldstein*, Kelvyn Jones*, George Leckie* and Luc Moreau** *Centre for Multilevel Modelling, University of Bristol. **Electronics and Computer Science, University of Southampton. November 2018 i An Advanced User’s Guide to Stat-JR version 1.0.6 © 2018. William J. Browne, Christopher M.J. Charlton, Danius T. Michaelides, Richard M.A. Parker, Bruce Cameron, Camille Szmaragd, Huanjia Yang, Zhengzheng Zhang, Harvey Goldstein, Kelvyn Jones, George Leckie and Luc Moreau. No part of this document may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, for any purpose other than the owner's personal use, without the prior written permission of one of the copyright holders. ISBN: To be confirmed Printed in the United Kingdom ii Contents Contents ................................................................................................................................................. iii 1 About Stat-JR ................................................................................................................................... 1 1.1 Stat-JR: software for scaling statistical heights. ..................................................................... 1 1.2 About the Advanced User’s Guide .......................................................................................... 2 2 Installation instructions .................................................................................................................. 3 3 A simple regression template example ........................................................................................... 4 3.1 Running a first template ......................................................................................................... 4 3.2 Opening the bonnet and looking at the code ......................................................................... 9 3.2.1 Inputs ............................................................................................................................ 11 3.2.2 Model ............................................................................................................................ 12 3.2.3 Latex .............................................................................................................................. 13 3.2.4 Some points to note ...................................................................................................... 15 3.3 Writing your own first template ........................................................................................... 15 3.3.1 Exercise 1 ...................................................................................................................... 16 4 Running templates with the eStat engine .................................................................................... 17 4.1 Algebra and Code Generation ............................................................................................... 17 4.2 The algebraic software system ............................................................................................. 22 5 Including Interoperability .............................................................................................................. 26 5.1 eStat.py ................................................................................................................................. 26 5.2 Regression2.py ...................................................................................................................... 27 5.3 WinBUGS and Winbugsscript.py ........................................................................................... 28 5.4 MLwiN ................................................................................................................................... 32 5.5 R ............................................................................................................................................ 37 5.6 Other packages ..................................................................................................................... 43 6 Input, data manipulation and output templates .......................................................................... 45 6.1 Generate template (generate.py) ......................................................................................... 45 iii 6.1.1 Exercise 2 ...................................................................................................................... 48 6.2 Recode template (recode.py) ............................................................................................... 48 6.2.1 Exercise 3 ...................................................................................................................... 50 6.3 AverageAndCorrelation template ......................................................................................... 50 6.3.1 Exercise 4 ...................................................................................................................... 52 6.4 XYPlot template .................................................................................................................... 53 6.4.1 Exercise 5 ...................................................................................................................... 55 7 Single level models of all flavours – A logistic regression example .............................................. 56 7.1 Inputs .................................................................................................................................... 58 7.2 Engines .................................................................................................................................. 59 7.3 Model .................................................................................................................................... 59 7.4 LaTeX ..................................................................................................................................... 61 7.4.1 Exercise 6 ...................................................................................................................... 61 8 Including categorical predictors .................................................................................................... 63 9 Multilevel models ......................................................................................................................... 68 9.1 2LevelMod template ............................................................................................................. 68 9.1.1 Exercise 7 ...................................................................................................................... 73 9.2 NLevelMod template ............................................................................................................ 73 9.2.1 Exercise 8 ...................................................................................................................... 79 10 Using the Preccode method ...................................................................................................... 80 10.1 The 1LevelProbitRegression template .................................................................................. 80 10.2 preccode and deviancecode attributes ................................................................................ 83 11 Multilevel models with Random slopes and the inclusion of Wishart priors ........................... 86 11.1 An example with random slopes........................................................................................... 86 11.2 Preccode for NLevelRS .......................................................................................................... 91 11.2.1 Exercise 9 ...................................................................................................................... 93 12 Improving mixing (1LevelBlock and 1LevelOrthogParam) ........................................................ 94 iv 12.1 Rats example ......................................................................................................................... 94 12.2 The 1LevelBlock template ..................................................................................................... 95 12.3 The 1LevelOrthogParam template ........................................................................................ 98 12.3.1 Exercise 10 .................................................................................................................. 102 12.4 Multivariate Normal response models ............................................................................... 102 12.5 The preccode function for this template ............................................................................ 105 13 Out of sample predictions ....................................................................................................... 111 13.1 The 1LevelOutSampPred template – using the zxfd trick ................................................... 111 13.1.1 Exercise 11 .................................................................................................................. 113 14 References .............................................................................................................................. 114

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    121 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us