CDOoDocuments.StdDocumentDescDocuments.DocumentDescContainers.ViewDescViews.ViewDescStores.StoreDescDocuments.ModelDescContainers.ModelDescModels.ModelDescStores.ElemDesc TextViews.StdViewDescTextViews.ViewDescTextModels.StdModelDescTextModels.ModelDescTextModels.AttributesDesc'*@ * bbmodel{ for (i in 1:n){ # stochastic component goals1[i]~dpois(lambda1[i]) goals2[i]~dpois(lambda2[i]) # link and linear predictor log(lambda1[i])<- mu + home + a[ ht[i] ] + d[ at[i] ] log(lambda2[i])<- mu + a[ at[i] ] + d[ ht[i] ] } # STZ constraints a[1]<- -sum( a[2:20] ) d[1]<- -sum( d[2:20] ) # # prior distributions mu~dnorm(0,0.001) home~dnorm(0,0.001) for (i in 2:K){ a[i]~dnorm(0,0.01) d[i]~dnorm(0,0.01) } # calculation of the predicted differences pred.diff[1] <- goals1[379]-goals2[379] pred.diff[2] <- goals1[380]-goals2[380] # # calculation of the probability of each game outcome (win/draw/loss) for (i in 1:2){ outcome[i,1] <- 1 - step( -pred.diff[i] ) # home wins (diff>0) outcome[i,2] <- equals( pred.diff[i] , 0.0 ) # draw (diff=0) outcome[i,3] <- 1-step( pred.diff[i] ) # home loses (diff<0) } # # calculation of the probability of each difference for (i in 1:2){ pred.diff.counts[i,1] <- 1-step( pred.diff[i] + 5 ) # less than -5 for (k in 2:12){ pred.diff.counts[i,k] <- equals( pred.diff[i] , k-7 ) # equal to k-7 (-5 to 5) } pred.diff.counts[i,13] <- step( pred.diff[i] - 6 ) # greater than 5 } } INITS list( mu=0.5, home=0.5, a=c(NA, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0) , d=c(NA, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0) ) DATA - LIST FORMAT list(n=380, K=20, ht = c(16, 1, 7, 13, 14, 15, 19, 4, 11, 6, 18, 17, 2, 10, 3, 5, 8, 12, 9, 5, 8, 17, 18, 20, 10, 2, 3, 12, 7, 1, 4, 6, 13, 14, 16, 11, 19, 15, 5, 4, 7, 16, 18, 6, 3, 17, 19, 11, 9, 9, 1, 2, 8, 10, 12, 20, 15, 13, 14, 4, 5, 6, 7, 16, 19, 3, 11, 17, 18, 20, 1, 2, 9, 10, 12, 14, 15, 13, 8, 20, 5, 6, 7, 2, 11, 3, 12, 17, 15, 16, 1, 4, 8, 9, 14, 18, 13, 19, 10, 8, 4, 5, 9, 11, 18, 13, 19, 2, 17, 10, 6, 7, 12, 14, 16, 20, 3, 15, 1, 10, 1, 6, 7, 14, 15, 16, 12, 20, 3, 5, 2, 8, 9, 19, 4, 13, 17, 11, 18, 2, 8, 4, 9, 11, 1, 3, 14, 15, 16, 20, 12, 7, 10, 5, 17, 13, 19, 11, 3, 9, 12, 14, 17, 18, 4, 6, 16, 6, 20, 5, 1, 13, 15, 20, 2, 7, 10, 19, 8, 8, 1, 2, 9, 10, 12, 13, 14, 15, 20, 6, 17, 19, 3, 4, 7, 11, 16, 18, 5, 5, 3, 4, 6, 7, 11, 17, 19, 16, 9, 8, 10, 12, 14, 15, 20, 13, 1, 2, 18, 4, 5, 6, 11, 16, 19, 3, 7, 17, 9, 2, 8, 12, 13, 14, 15, 10, 20, 1, 18, 14, 16, 19, 15, 6, 4, 11, 13, 9, 2, 3, 5, 8, 10, 18, 20, 12, 17, 15, 6, 7, 11, 13, 16, 19, 14, 4, 1, 18, 7, 8, 5, 9, 12, 18, 20, 3, 17, 9, 1, 8, 10, 13, 16, 18, 14, 4, 19, 2, 10, 11, 6, 12, 15, 17, 20, 3, 5, 2, 7, 9, 4, 5, 8, 11, 13, 19, 18, 17, 2, 10, 7, 6, 1, 3, 12, 15, 16, 20, 14, 18, 2, 4, 8, 13, 5, 1, 10, 12, 14, 15, 16, 20, 7, 1, 11, 3, 9, 19, 17, 4, 5, 8, 9, 18, 19, 11, 13, 2, 6, 7, 3, 10, 12, 14, 16, 20, 1, 15, 10, 7, 8, 13, 15, 19, 20, 2, 1, 5, 6, 17, 3, 4, 6, 9, 11, 12, 14, 16, 17, 18), at = c(9, 2, 18, 20, 3, 12, 5, 17, 8, 10, 19, 16, 15, 14, 7, 11, 4, 6, 19, 4, 16, 7, 11, 15, 1, 13, 6, 14, 9, 12, 18, 5, 8, 20, 3, 17, 2, 10, 14, 12, 20, 15, 2, 9, 10, 8, 13, 1, 13, 17, 16, 5, 6, 19, 3, 18, 11, 7, 4, 9, 1, 2, 10, 12, 15, 20, 13, 14, 8, 11, 18, 17, 3, 16, 7, 19, 6, 4, 5, 10, 18, 14, 16, 8, 9, 4, 13, 19, 1, 6, 7, 11, 20, 2, 15, 17, 5, 3, 12, 7, 20, 10, 15, 14, 12, 16, 1, 3, 6, 13, 18, 2, 19, 8, 4, 5, 11, 17, 9, 8, 13, 19, 4, 18, 5, 11, 9, 2, 17, 7, 12, 15, 10, 16, 1, 14, 20, 6, 16, 10, 1, 6, 14, 7, 17, 8, 2, 4, 5, 9, 11, 19, 18, 3, 12, 15, 20, 10, 13, 8, 20, 7, 5, 15, 19, 1, 2, 13, 1, 9, 14, 18, 3, 16, 4, 6, 17, 11, 12, 19, 3, 11, 18, 4, 5, 17, 16, 7, 6, 15, 2, 14, 9, 13, 12, 20, 10, 1, 8, 2, 12, 14, 8, 13, 15, 9, 10, 1, 4, 18, 7, 16, 17, 19, 3, 11, 5, 6, 9, 10, 12, 20, 2, 14, 8, 1, 15, 13, 6, 18, 17, 4, 19, 5, 16, 3, 7, 11, 3, 12, 8, 9, 20, 3, 5, 18, 2, 7, 19, 16, 6, 13, 15, 4, 14, 1, 11, 2, 12, 3, 5, 9, 17, 18, 10, 8, 20, 20, 17, 11, 19, 16, 15, 7, 13, 14, 4, 11, 15, 2, 20, 12, 7, 5, 6, 3, 17, 1, 6, 4, 16, 10, 14, 18, 8, 19, 13, 9, 1, 1, 16, 20, 14, 3, 10, 12, 6, 15, 7, 5, 8, 17, 19, 2, 18, 9, 13, 4, 11, 14, 20, 7, 10, 1, 15, 4, 9, 2, 13, 8, 19, 17, 5, 10, 16, 18, 12,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 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 0, 0, 1, 3, 0, 0, 1, 1, 1, 1, 1, 0, 1, 2, 2, 2, 4, 1, 1, 1, 0, 2, 0, 1, 0, 2, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 2, 1, 2, 2, 3, 1, 2, 1, 1, 3, 0, 0, 1, 0, 3, 1, 0, 0, 3, 1, 1, 0, 1, 0, 4, 2, 3, 1, 1, 0, 1, 0, 1, 0, 0, 2, 4, 1, 2, 3, 1, 0, 3, 1, 0, 1, 0, 0, 2, 2, 1, 1, 0, 1, 2, 0, 1, 3, 2, 1, 2, 1, 1, 0, 2, NA, NA) ) 1-1 TextControllers.StdCtrlDescTextControllers.ControllerDescContainers.ControllerDescControllers.ControllerDesc TextRulers.StdRulerDescTextRulers.RulerDescTextRulers.StdStyleDescTextRulers.StyleDescZTextRulers.AttributesDesc$ Zo * ,[ @Documents.ControllerDesc Ws,! [h$