ALARM Your house has an alarm system against burglary. The house is located in the seismically active area and the alarm system can get occasionally set off by an earthquake. You have two neighbors, Mary and John, who do not know each other. If they hear the alarm they call you, but this is not guaranteed. They also call you from time to time just to chat. The BUGS code provides an approximate solution for conditional distributions of nodes given the evidence. model { burglary ~ dcat(p.burglary[]); earthquake ~ dcat(p.earthquake[]); alarm ~ dcat(p.alarm[burglary,earthquake,]); Marycalls ~ dcat(p.Marycalls[alarm,]); Johncalls ~ dcat(p.Johncalls[alarm,]) } DATA IN: list( #hard evidence , uncomment and instantiate... # burglary = 1, # earthquake = 1, # alarm = 1, # Marycalls = 1, # Johncalls = 1, #initial distributions p.burglary = c(0.999,0.001), p.earthquake = c(0.998,0.002), # conditionals p.alarm = structure(.Data = c(0.999, 0.001, 0.71, 0.29, 0.06, 0.94, 0.05, 0.95), .Dim = c(2,2,2)), p.Marycalls = structure(.Data = c(0.99, 0.01, 0.30, 0.70), .Dim = c(2,2)), p.Johncalls = structure(.Data = c(0.95, 0.05, 0.10, 0.90), .Dim = c(2,2)) ) INITS NONE, just 'gen inits'