I would like to fit a linear model (lm) where the residuals variance is clearly dependent on the explanatory variable.
The way I know to do this is by using glm with the Gamma family to model the variance, and then put its inverse into the weights in the lm function (example: http://nitro.biosci.arizona.edu/r/chapter31.pdf)
I was wondering:
- Is this the only technique?
- What other approaches are relevant?
- What R packages/functions relevant to this type of modelling? (other then glm, lm)
glm()thenlm()in the chapter you link to. Seems to me theglm()is all that is required and used there, but I may have missed something. You can try generalised least squares (gls()in nlme) which allows weights to be estimated to control for the type of heteroscedasticity you mention; see?varFuncand follow the links from there. IIRCvarFixed()will do what you want. – Gavin Simpson Aug 14 '12 at 21:35Ocram - thanks, but I do not use SAS.
– Tal Galili Aug 15 '12 at 15:47