# Can I use generalised least squares with a binomial distribution and a nested structure?

I'm trying to fit linear models to my data in R. I need to use a generalised least squares method as I have heterogeneity of variance in one of my variables. I was planning to use varIdent, as the variable is nominal.

But - I also want to have a random term as my data have a nested structure, and my data need to be modelled using a binomial distribution. I can't find any information on whether this is possible using the gls command in package nlme, does anyone have any information that could help me, please?

• I'm a little confused; you say you have heterogeneity of variance, which means the variance in the response differs by one of your predictors, but you also say you need a binomial distribution, which means that your response is binomial. While different variances are possible (though would be called over or underdispersion in this case), as far as I know, it's not something that is easy to check without fitting the model in the first place. How do you know the variances are different? Commented Feb 23, 2012 at 14:19
• I'll extend Aaron's question a little - how are the variances different other than the differences binomially distributed variates would have due to different $n$ and $p$? If one of your explanatory variables has heterogeneous variance, that's not an issue, but a binomial response can't have a heterogeneous variance given $n$ and $p$. Commented Feb 23, 2012 at 22:39