CDOoDocuments.StdDocumentDescDocuments.DocumentDescContainers.ViewDescViews.ViewDescStores.StoreDescxDocuments.ModelDescContainers.ModelDescModels.ModelDescStores.ElemDesc TextViews.StdViewDescTextViews.ViewDeschTextModels.StdModelDescTextModels.ModelDescrjTextModels.AttributesDesc1$Courier New $Courier NewB #z#------------------------------------------------------------------------------------------------------------------------------ Version 1 (simple) #------------------------------------------------------------------------------------------------------------------------------ model{ # ----------------------------------------- # current model # ----------------------------------------- # initial definition of variables for the current model for (i in 1:n){ y[i] <- log(O2UP[i]) x[i,1]<-BOD[i] x[i,2]<-TKN[i] x[i,3]<-TS[i] x[i,4]<-TVS[i] x[i,5]<-COD[i] } # model specificication of the current model for (i in 1:n){ y[i] ~ dnorm( mu[i], tau ) mu[i] <- beta0 + beta[1] * gamma[1]*x[i,1] + beta[2] * gamma[2]*x[i,2] + beta[3] * gamma[3]*x[i,3] + beta[4] * gamma[4]*x[i,4] + beta[5] * gamma[5]*x[i,5] } # prior distributions beta0~dnorm(0, 0.001) for (j in 1:p){ beta[j]~dnorm(0, 0.001) } tau~dgamma( 0.001, 0.001) # ------------------------------------------------------------------------------- # definition of gammas for candidate models for (k in 1:p){ for (j in 1:p){ gamma.can[j,k] <- gamma[j]*(1-equals( k,j )) + (1-gamma[j])*equals( k,j ) } } # response data for candidate models for (i in 1:n){ y1[i] <- y[i] y2[i] <- y[i] y3[i] <- y[i] y4[i] <- y[i] y5[i] <- y[i] y1[i] ~ dnorm( mu.can[i,1], tau.can[1] ) y2[i] ~ dnorm( mu.can[i,2], tau.can[2] ) y3[i] ~ dnorm( mu.can[i,3], tau.can[3] ) y4[i] ~ dnorm( mu.can[i,4], tau.can[4] ) y5[i] ~ dnorm( mu.can[i,5], tau.can[5] ) } # # linear predictors for each model for (k in 1:p){ for (i in 1:n){ mu.can[i,k] <- beta0.can[k] + beta.can[1,k] * gamma.can[1,k]*x[i,1] + beta.can[2,k] * gamma.can[2,k]*x[i,2] + beta.can[3,k] * gamma.can[3,k]*x[i,3] + beta.can[4,k] * gamma.can[4,k]*x[i,4] + beta.can[5,k] * gamma.can[5,k]*x[i,5] } } # # prior distributions for parameters of candidate models for (k in 1:p){ beta0.can[k]~dnorm(0, 0.001) for (j in 1:p){ beta.can[j,k]~dnorm(0, 0.001) } tau.can[k]~dgamma( 0.001, 0.001) } } #------------------------------------------------------------------------------------------------------ # after loading the following initial values, press "gen inits" button to generate the remaining ones. INITS list( beta0=0, beta=c(0,0,0,0,0), tau=1, tau.can=c(1,1,1,1,1) ) DATA (LIST) list(n=20, p=5, gamma=c(0,0,1,0,1), BOD = c(1125, 920, 835, 1000, 1150, 990, 840, 650, 640, 583, 570, 570, 510, 555, 460, 275, 510, 165, 244, 79), TKN = c(232, 268, 271, 237, 192, 202, 184, 200, 180, 165, 151, 171, 243, 147, 286, 198, 196, 210, 327, 334), TS = c(7160, 8804, 8108, 6370, 6441, 5154, 5896, 5336, 5041, 5012, 4825, 4391, 4320, 3709, 3969, 3558, 4361, 3301, 2964, 2777), TVS = c(85.9, 86.5, 85.2, 83.8, 82.1, 79.2, 81.2, 80.6, 78.4, 79.3, 78.7, 78, 72.3, 74.9, 74.4, 72.5, 57.7, 71.8, 72.5, 71.9), COD = c(8905, 7388, 5348, 8056, 6960, 5690, 6932, 5400, 3177, 4461, 3901, 5002, 4665, 4642, 4840, 4479, 4200, 3410, 3360, 2599), O2UP = c(36, 7.9, 5.6, 5.2, 2, 2.3, 1.3, 1.3, 0.6, 0.7, 1, 1, 0.8, 0.6, 0.4, 0.7, 0.6, 0.4, 0.3, 0.9)) GAMMAs FOR DIC-STEPWIZE STARTING FROM FULL step1: Full => list(gamma=c(1,1,1,1,1)) step2: -X1 => list(gamma=c(0,1,1,1,1)) step3: -X4 => list(gamma=c(0,1,1,0,1)) step4: -X2 => list(gamma=c(0,1,0,0,1)) GAMMAs FOR DIC-STEPWIZE STARTING FROM CONSTANT step1: Constant => list(gamma=c(0,0,0,0,0)) step2: +X3 => list(gamma=c(0,0,1,0,0)) step3: +X5 => list(gamma=c(0,0,1,0,1)) TextControllers.StdCtrlDescTextControllers.ControllerDescContainers.ControllerDescControllers.ControllerDesc TextRulers.StdRulerDescTextRulers.RulerDescTextRulers.StdStyleDescTextRulers.StyleDescZTextRulers.AttributesDesc$ ZGo * ,[ @Documents.ControllerDesc t]s ' `h*