Post date: May 29, 2017 2:30:35 AM
27-29v17. When we did a regression for each population, we had some small populations whose values were all zero or nearly zero since they the mean for each population becomes 0. A single regression for area won't work because the slope is negative (anna and ricei have really big wings and small elements). We plotted a1 element area vs. wing area for a few populations with decent sample sizes, and the slopes are different (e.g., YBG = 0, ABM = neg, GNP = pos). Similarly, by population, the extent of sex dimorphism varies (e.g., ABM and SIN: males and females very different for a1 size, but not much dimorphism and GNP and MTR).
So, we will do a Bayesian regression so that small sample sized populations will get the average slops of everybody but large sample plots can get their own slope (there will be a population specific effect of size and a population specific effect of sex).
Zach is using the following infiles for this: size-26v17, coord-centroidsize-procrustes-26v17.csv
We need to make a figure for the supplement for the paper to show why we're going with the Bayesian regression: 2 panes with regression slopes for each pop colored by subgroup with all points in light gray for an element area and an element position, 2 panes with box plots for each subgroup and sex for an element size and an element position. Consider a1 and cu21a for the example elements for this.
29v17. We found an outlier: m3 for SIN10-067 was -1000. It should be 0. I fixed this in size-26v17. While I was doing this I discovered there weren't any other 0's in this dataset. There should be NAs and 0s. This is now fixed in size-29v17.csv.
The Bayesian regression finished for the position data. The residuals are in: resid-coord-centroidsize-procrustes-26v17.csv. The size residuals are in: resid-size-29v17.csv. This is all in Dropbox > mapping > morphoj-26v17-andSize > residuals-29v17
The model:
model
{
for(i in 1:n){
## normal sampling distribution
y[i] ~ dnorm(mu[i],tau)
## linear model, pop int., pop effect of size, pop effect of sex
mu[i]<- beta0[pop[i]] + beta1[pop[i]] *x[i] + beta2[pop[i]] * sex[i]
resid[i]<-y[i] - mu[i] + beta0[pop[i]] ## does not remove population mean
}
## hierarchical priors
for(j in 1:npop){
beta0[j] ~ dnorm(a[1],b[1])
beta1[j] ~ dnorm(a[2],b[2])
beta2[j] ~ dnorm(a[3],b[3])
}
## top-level priors
for(k in 1:3){
a[k] ~ dnorm(0,1e-5)
b[k] ~ dgamma(0.1,0.01)
}
tau ~ dgamma(0.1,0.01)
}