Solved – use generalised least squares with a binomial distribution and a nested structure

generalized-least-squaresheteroscedasticitymixed modelrvariance

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?

Best Answer

By GLS do you mean GLM? The GLM is a method of iteratively reweighted least squares which takes the mean-variance relationship into account when estimating the model parameters. Generalized Least Squares will still either suffer from an overfitting issue (infinite weights), or overprediction (fitted probabilities greater than 1 or less than 0). The logistic regression model is commonly used to test for associations with binary outcomes. It's possible to go further and use Generalized Linear Mixed Models (GLMMs), conditional logistic regression, or Generalized Estimating Equations (GEEs) to account for certain correlation structures in the data. The nlme package has the mixed models, survival has clogit, and the geese package for GEEs.

Related Question