[R] mixed models question

Lorenz.Gygax@fat.admin.ch Lorenz.Gygax at fat.admin.ch
Wed Jun 16 07:40:26 CEST 2004


Hi Chris,

> I am trying to fit the following linear model to logged per capita 
> fecundity data (ie number of babies per female) for a mouse:
> 
> RsNRlS <- glm(formula = ln.fecundity ~ summer.rainfall + N + 
> lagged.rainfall + season, ....)
> 
> I am using this relationship in a simulation model, and the current 
> statistical model I have fit is unsatisfactory.  The problem is I get a 
> global estimate of variance (MSE), but I think it varies across subsets 
> of the data.  Specifically, seasons when there is lots of reproduction 
> (e.g. fall) tend to have high variance, while seasons with little 
> reproduction (e.g. summer) have small amounts of variance.  I am 
> looking for a method for estimating the coefficients in my linear 
> model, and estimating a separate error for subsets of the data (ie for 
> each of the 4 seasons).  The end goal is to take this linear model back 
> into my simulation model to make predictions about fecundity, but with 
> separate variance terms for subsets of the data.

Are you using glm because you need a specific distribution family (such like
poisson)?

If not, you could possibly use gls with the argument

weights= varFixed (~ season)

With that you estimate your parameters and at the same time you allow for
(and estimate) the different variances for the season.

If you need the poisson distribution, I am not quite sure what to do.
Perhaps glm also accepts this weight argument or perhaps you need to work
with a generalised procedure of lme (either from one of the new lme packages
or from MASS).

Regards, Lorenz
- 
Lorenz Gygax, Dr. sc. nat.
Tel: +41 (0)52 368 33 84 / lorenz.gygax at fat.admin.ch      

Center for proper housing of ruminants and pigs
Swiss Veterinary Office
agroscope FAT Tänikon, CH-8356 Ettenhausen / Switzerland
Fax : +41 (0)52 365 11 90 / Tel: +41 (0)52 368 31 31




More information about the R-help mailing list