Print

Print


Dear all Bugs user,
Recently I am looking into the relationship between Shark's fin length
(fl) and regions, group, sex by using BMA. See my two Winbugs files
below, 18 different models were built up. One used the original data,
one used standardized data. The one used original data has the totally
different results from the one with standardized data has. Which one is
more proper? I found many examples standardized their data, but I have
no clue why?  Really appreciate any one to help me solve this puzzle.

#### Original data
model 
{
   for(i in 1:M) {  
  fl[i] ~ dnorm(mu[i],tau)
   mu[i] <- a1 + Ind.group*a2*group[i] + Ind.sex*a3*sex[i] +
Ind.region*a4*region[i] + Ind.groupbysex*a5*group[i]*sex[i] +
Ind.groupbyregion*a6*group[i]*region[i] +
Ind.sexbyregion*a7*sex[i]*region[i]
   }

tau~dgamma(1,1)

tau.constant<- 1.0E-6
tau.group <- 1.0E-6+(Ind.group*1.0E-5)
tau.sex<-1.0E-6+(Ind.sex*1.0E-5)
tau.region<- 1.0E-6+(Ind.region*1.0E-5)
tau.group.sex <-1.0E-6+(Ind.groupbysex*1.0E-5)
tau.group.region<- 1.0E-6+(Ind.groupbyregion*1.0E-5)
tau.sex.region <-1.0E-6+(Ind.sexbyregion*1.0E-5)

a1 ~ dnorm(0, tau.constant)
a2~ dnorm(0, tau.group)
a3~ dnorm(0, tau.sex)
a4 ~ dnorm(0, tau.region)
a5~ dnorm(0, tau.group.sex)
a6~ dnorm(0, tau.group.region)
a7~ dnorm(0, tau.sex.region)

Model ~ dcat(p[])
for (i in 1:18)
{
p[i]<- 1/18
Ind.Model[i]<-equals(Model,i)
}

Ind.group<-equals(Model,2)+equals(Model,5)+equals(Model,6)+equals(Model,
8)+equals(Model,9)+equals(Model,10)+step(Model-11.5)

Ind.sex<-equals(Model,3)+equals(Model,5)+equals(Model,7)+equals(Model,8)
+equals(Model,9)+step(Model-10.5)

Ind.region<-equals(Model,4)+equals(Model,6)+equals(Model,7)+equals(Model
,8)+step(Model-9.5)

Ind.groupbysex<-equals(Model,9)+equals(Model,12)+equals(Model,15)+equals
(Model,16)+equals(Model,18)

Ind.groupbyregion<-equals(Model,10)+equals(Model,13)+equals(Model,15)+eq
uals(Model,17)+equals(Model,18)

Ind.sexbyregion<-equals(Model,11)+equals(Model,14)+step(Model-15.5)

}

Data click on one of the arrows to open the data 

Initial values
list(tau=1, Model=1)


#`Results

	 node	 mean	 sd	 MC error	2.5%	median	97.5%
start	sample
	Ind.Model[1]	0.0	0.0	7.001E-13	0.0	0.0
0.0	5001	20400
	Ind.Model[2]	0.0	0.0	7.001E-13	0.0	0.0
0.0	5001	20400
	Ind.Model[3]	0.0	0.0	7.001E-13	0.0	0.0
0.0	5001	20400
	Ind.Model[4]	0.0	0.0	7.001E-13	0.0	0.0
0.0	5001	20400
	Ind.Model[5]	0.0	0.0	7.001E-13	0.0	0.0
0.0	5001	20400
	Ind.Model[6]	0.0	0.0	7.001E-13	0.0	0.0
0.0	5001	20400
	Ind.Model[7]	0.0	0.0	7.001E-13	0.0	0.0
0.0	5001	20400
	Ind.Model[8]	0.004559	0.06736	0.002203	0.0
0.0	0.0	5001	20400
	Ind.Model[9]	0.0	0.0	7.001E-13	0.0	0.0
0.0	5001	20400
	Ind.Model[10]	0.0	0.0	7.001E-13	0.0	0.0
0.0	5001	20400
	Ind.Model[11]	0.0	0.0	7.001E-13	0.0	0.0
0.0	5001	20400
	Ind.Model[12]	0.0	0.0	7.001E-13	0.0	0.0
0.0	5001	20400
	Ind.Model[13]	0.8742	0.3316	0.01016	0.0	1.0	1.0
5001	20400
	Ind.Model[14]	0.003039	0.05505	0.001531	0.0
0.0	0.0	5001	20400
	Ind.Model[15]	0.05559	0.2291	0.006856	0.0	0.0
1.0	5001	20400
	Ind.Model[16]	1.961E-4	0.014	1.541E-4	0.0
0.0	0.0	5001	20400
	Ind.Model[17]	0.0602	0.2378	0.007913	0.0	0.0
1.0	5001	20400
	Ind.Model[18]	0.002206	0.04691	6.672E-4	0.0
0.0	0.0	5001	20400

###Standardized data
model 
{
mean.group<-mean(group[1:1153])
mean.sex<- mean(sex[1:1153])
mean.region<- mean(region[1:1153]) 
mean.groupsex<-mean(groupsex[1:1153])
mean.groupregion<-mean(groupregion[1:1153])
mean.sexregion<-mean(sexregion[1:1153])
sd.group<-sd(group[1:1153])
sd.sex<-sd(sex[1:1153])
sd.region<- sd(region[1:1153]) 
sd.groupsex<-sd(groupsex[1:1153])
sd.groupregion<-sd(groupregion[1:1153])
sd.sexregion<-sd(sexregion[1:1153])


 for(i in 1:M) {  
  groupregion[i]<-group[i]*region[i]
  groupsex[i]<-group[i]*sex[i]
 sexregion[i]<-sex[i]*region[i]
  G[i]<-(group[i]-mean.group)/sd.group
  S[i]<-(group[i]-mean.sex)/sd.sex 
  R[i]<-(region[i]-mean.region)/sd.region

  GS[i]<-(groupsex[i]-mean.groupsex)/sd.groupsex
  GR[i]<-(groupregion[i]-mean.groupregion)/sd.groupregion
  SR[i]<-(sexregion[i]-mean.sexregion)/sd.sexregion
}

for(i in 1:M) {  
  fl[i] ~ dnorm(mu[i],tau)
   mu[i] <- a1 + Ind.group*a2*G[i] + Ind.sex*a3*S[i] +
Ind.region*a4*R[i] + Ind.groupbysex*a5*GS[i] +
Ind.groupbyregion*a6*GR[i] + Ind.sexbyregion*a7*SR[i]
   }

tau~dgamma(1,1)

tau.constant<- 1.0E-6
tau.group <- 1.0E-6+(Ind.group*1.0E-5)
tau.sex<-1.0E-6+(Ind.sex*1.0E-5)
tau.region<- 1.0E-6+(Ind.region*1.0E-5)
tau.group.sex <-1.0E-6+(Ind.groupbysex*1.0E-5)
tau.group.region<- 1.0E-6+(Ind.groupbyregion*1.0E-5)
tau.sex.region <-1.0E-6+(Ind.sexbyregion*1.0E-5)

a1 ~ dnorm(0, tau.constant)
a2~ dnorm(0, tau.group)
a3~ dnorm(0, tau.sex)
a4 ~ dnorm(0, tau.region)
a5~ dnorm(0, tau.group.sex)
a6~ dnorm(0, tau.group.region)
a7~ dnorm(0, tau.sex.region)

Model ~ dcat(p[])
for (i in 1:18)
{
p[i]<- 1/18
Ind.Model[i]<-equals(Model,i)
}

Ind.group<-equals(Model,2)+equals(Model,5)+equals(Model,6)+equals(Model,
8)+equals(Model,9)+equals(Model,10)+step(Model-11.5)

Ind.sex<-equals(Model,3)+equals(Model,5)+equals(Model,7)+equals(Model,8)
+equals(Model,9)+step(Model-10.5)

Ind.region<-equals(Model,4)+equals(Model,6)+equals(Model,7)+equals(Model
,8)+step(Model-9.5)

Ind.groupbysex<-equals(Model,9)+equals(Model,12)+equals(Model,15)+equals
(Model,16)+equals(Model,18)

Ind.groupbyregion<-equals(Model,10)+equals(Model,13)+equals(Model,15)+eq
uals(Model,17)+equals(Model,18)

Ind.sexbyregion<-equals(Model,11)+equals(Model,14)+step(Model-15.5)

}

Data click on one of the arrows to open the data 

Initial values
list(tau=1, Model=1)


#`Results

	 node	 mean	 sd	 MC error	2.5%	median	97.5%
start	sample
	Ind.Model[1]	0.0	0.0	5.164E-14	0.0	0.0
0.0	15001	750000
	Ind.Model[2]	0.0	0.0	5.164E-14	0.0	0.0
0.0	15001	750000
	Ind.Model[3]	0.0	0.0	5.164E-14	0.0	0.0
0.0	15001	750000
	Ind.Model[4]	0.0	0.0	5.164E-14	0.0	0.0
0.0	15001	750000
	Ind.Model[5]	0.0	0.0	5.164E-14	0.0	0.0
0.0	15001	750000
	Ind.Model[6]	0.0	0.0	5.164E-14	0.0	0.0
0.0	15001	750000
	Ind.Model[7]	0.0	0.0	5.164E-14	0.0	0.0
0.0	15001	750000
	Ind.Model[8]	0.0	0.0	5.164E-14	0.0	0.0
0.0	15001	750000
	Ind.Model[9]	0.0	0.0	5.164E-14	0.0	0.0
0.0	15001	750000
	Ind.Model[10]	0.0	0.0	5.164E-14	0.0	0.0
0.0	15001	750000
	Ind.Model[11]	0.0	0.0	5.164E-14	0.0	0.0
0.0	15001	750000
	Ind.Model[12]	0.0	0.0	5.164E-14	0.0	0.0
0.0	15001	750000
	Ind.Model[13]	0.0	0.0	5.164E-14	0.0	0.0
0.0	15001	750000
	Ind.Model[14]	0.0	0.0	5.164E-14	0.0	0.0
0.0	15001	750000
	Ind.Model[15]	0.0	0.0	5.164E-14	0.0	0.0
0.0	15001	750000
	Ind.Model[16]	0.007037	0.08359	0.001292	0.0
0.0	0.0	15001	750000
	Ind.Model[17]	0.0	0.0	5.164E-14	0.0	0.0
0.0	15001	750000
	Ind.Model[18]	0.993	0.08359	0.001292	1.0	1.0
1.0	15001	750000

___________________________
Guojing YANG
Research Fellow
Wildlife & Landscape Sciences Theme
School for Environmental Research
Charles Darwin University
Darwin NT 0909
Ph: (08) 8946 6646
Fax: (08) 8946 7720
http://www.cdu.edu.au/ser/GuojingYangProfile.htm



-------------------------------------------------------------------
This list is for discussion of modelling issues and the BUGS software.
For help with crashes and error messages, first mail [log in to unmask]
To mail the BUGS list, mail to [log in to unmask]
Before mailing, please check the archive at www.jiscmail.ac.uk/lists/bugs.html
Please do not mail attachments to the list.
To leave the BUGS list, send LEAVE BUGS to [log in to unmask]
If this fails, mail [log in to unmask], NOT the whole list