WinBUGSUserManualVersion1.4,January2003DavidSpiegelhalter1AndrewThomas2NickyBest2DaveLunn21MRCBiostatisticsUnit,InstituteofPublicHealth,RobinsonWay,CambridgeCB22SR,UK2DepartmentofEpidemiology&PublicHealth,ImperialCollegeSchoolofMedicine,NorfolkPlace,LondonW21PG,UKe-mail:bugs@mrc-bsu.cam.ac.uk[general]andrew.thomas@ic.ac.uk[technical]internet::MCMCsamplingcanbedangerous!ContentsIntroductionThismanualAdvicefornewusersMCMCmethodsHowWinBUGSsyntaxdiffersfromthatofClassicBUGSChangesfromWinBUGS1.3CompoundDocumentsWhatisacompounddocument?WorkingwithcompounddocumentsEditingcompounddocumentsŁ ŁCompounddocumentsande-mailPrintingcompounddocumentsandDoodlesReadingintextfilesModelSpecificationGraphicalmodelsGraphsasaformallanguageTheBUGSlanguage:stochasticnodesCensoringandtruncationConstraintsonusingcertaindistributionsLogicalnodesArraysandindexingRepeatedstructuresDatatransformationsNestedindexingandmixturesFormattingofdataDoodleBUGS:TheDoodleEditorGeneralpropertiesCreatinganodeSelectinganodeDeletinganodeMovinganodeCreatingaplateSelectingaplateDeletingaplateMovingaplateResizingaplateCreatinganedgeDeletinganedgeMovingaDoodleResizingaDoodlePrintingaDoodleTheModelMenuGeneralpropertiesSpecification...Update...MonitorMetropolisSaveStateSeed...ScriptTheInferenceMenuGeneralpropertiesSamples...Compare...Correlations...Summary...Rank...DIC... Ł Ł Ł ŁTheInfoMenuGeneralpropertiesOpenLogClearLogNodeinfo...ComponentsTheOptionsMenuOutputoptions...Blockingoptions...Updateoptions...Batch-mode:ScriptsTricks:AdvancedUseoftheBUGSLanguageSpecifyinganewsamplingdistributionSpecifyinganewpriordistributionSpecifyingadiscreteprioronasetofvaluesUsingpDandDICMixturesofmodelsofdifferentcomplexityWherethesizeofasetisarandomquantityAssessingsensitivitytopriorassumptionsModellingunknowndenominatorsHandlingunbalanceddatasetsLearningabouttheparametersofaDirichletdistributionUseofthecutfunctionWinBUGSGraphicsGeneralpropertiesMarginsAxisBoundsTitlesAllPlotsFontsSpecificproperties(viaSpecial...)DensityplotBoxplotCaterpillarplotModelfitplotScatterplotTipsandTroubleshootingRestrictionswhenmodellingSomeerrormessagesSomeTrapmessagesTheprogramhangsSpeedingupsamplingImprovingconvergence Ł Ł Ł Ł Ł TutorialIntroductionSpecifyingamodelintheBUGSlanguageRunningamodelinWinBUGSMonitoringparametervaluesCheckingconvergenceHowmanyiterationsafterconvergence?ObtainingsummariesoftheposteriordistributionChangingMCMCDefaults(advancedusersonly)DefaultsfornumbersofiterationsDefaultsforsamplingmethodsDistributionsDiscreteUnivariateContinuousUnivariateDiscreteMultivariateContinuousMultivariateReferencesIntroductionContentsThismanualAdvicefornewusersMCMCmethodsHowWinBUGSsyntaxdiffersfromthatofClassicBUGSChangesfromWinBUGS1.3Thismanual[top|home]ThismanualdescribestheWinBUGSsoftware-aninteractiveWindowsversionoftheBUGSprogramforBayesiananalysisofcomplexstatisticalmodelsusingMarkovchainMonteCarlo(MCMC)techniques.WinBUGSallowsmodelstobedescribedusingaslightlyamendedversionoftheBUGSlanguage,orasDoodles(graphicalrepresentationsofmodels)whichcan,ifdesired,betranslatedtoatext-baseddescription.TheBUGSlanguageismoreflexiblethantheDoodles.Thesectionscoverthefollowingtopics:Introduction:thesoftwareandhowanewusercanstartusingWinBUGS.DifferenceswithpreviousincarnationsofBUGSandWinBUGSaredescribed.CompoundDocuments:theuseofthecompounddocumentinterfacethatunderliestheprogram,showinghowdocumentscanbecreated,editedandmanipulated.ModelSpecification:theroleofgraphicalmodelsandthespecificationoftheBUGSlanguage.DoodleBUGS:TheDoodleEditor:theDoodleBUGSsoftwarewhichallowscomplexBayesianmodelstobeŁ Ł Ł specifiedasDoodlesusingagraphicalinterface.TheModelMenu:theModelMenupermitsmodelsexpressedaseitherDoodlesorintheBUGSlanguagetobeparsed,checkedandcompiled.TheInferenceMenu:theInferenceMenucontrolsthemonitoring,displayandsummaryofthesimulatedvariables:toolsincludespecializedgraphicsandspace-savingshort-cutsforsimplesummariesoflargenumbersofvariables.TheInfoMenu:theInfomenuprovidesalogoftherunandotherinformation.TheOptionsMenu:facilitythatallowstheusersomecontroloverwheretheoutputisdisplayedandthevariousavailableMCMCalgorithms.Batch-mode:Scripts:howtorunWinBUGSinbatch-modeusing'scripts'.Tricks:AdvancedUseoftheBUGSLanguage:specialtricksfordealingwithnon-standardproblems,e.g.specificationofarbitrarylikelihoodfunctions.WinBUGSGraphics:howtodisplayandchangetheformatofgraphicaloutput.TipsandTroubleshooting:tipsandtroubleshootingadviceforfrequentlyexperiencedproblems.Tutorial:atutorialfornewusers.ChangingMCMCDefaults(advancedusersonly):howt