In mer_finalize(ans) : gr cannot be computed at initial par (65)
On Mon, Aug 2, 2010 at 12:18 AM, Sol Heber
<sol.heber at pg.canterbury.ac.nz> wrote:
Dear R List ? I am trying to use a GLMM to analyse data on breeding success from crossing experiments between inbred lines of fruit flies but am having problems. My response variable is a proportion (proportion of eggs that hatched into adults), I have two fixed factors (one of them, ?cross?, has 4 levels: inbred, 1st or 2nd generation hybrid, and outbred, while the other fixed factor, ?line?, has 3 levels: the initial two lines of fruit flies used for the experiments and the resulting hybrid line), and two random terms ? female and male origin (to control for the fact that eggs of the same pair are not independent). My experimental design therefore looks something like this (resulting in missing cells in some of the combinations, e.g. there would be no data for the interaction inbred*AB, because in the inbred category there is no mix of the two lines): Cross ? ? ? ? ? ? ? ? ? ? ? ? ? Lines Inbred ? ? ? ? ?AA ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?BB Hybrid F1 ? ? ? A1A2 ? ? ? ? ? ?AB ? ? ? ? ? ? ?B1B2 Hybrid F2 ? ? ? A1A2 ? ? ? ? ? ?AB ? ? ? ? ? ? ?B1B2 Outbred ? ? ? ? AA ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?BB I have been using the following commands:
data<-read.table(file="data.txt",header=TRUE) attach(data) names(data)
?[1] "cross" ? ? "line" ? ? ?"forigin" ? "morigin" ?[6] "eggs" ? ? ? "adults"
library(lme4)
y<-cbind(adults,(eggs-adults))
model1<-lmer(y~cross*line+(1|forigin)+(1|morigin),family=binomial)
But I get the error message: In mer_finalize(ans) : gr cannot be computed at initial par (65)
I suppose that I receive this error message because the experimental design is unbalanced, because as soon as I take out the interaction between the explanatory variables, R seems to be able to run the model. But it is precisely the interaction between ?cross? and ?line? that I am interested in.
It appears that you have the classic situation of a two-way layout with missing cells. This is an example of a situation where the symbolic analysis performed by model.matrix does not detect rank deficiency in the result. The model with the term cross * line is equivalent to fitting a "cell means" model which includes the interaction term cross:line but not the main effects terms cross and line. However, the model matrix for cross:line will be constructed properly because it will drop the unused levels (i.e. the missing cells) in the interaction factor. So, try to fit with cross:line instead of cross*line.
So I have tried a different approach, by coding the origin of each individual fly: instead of using ?cross? and ?line? I have tried using maternal grandmother, maternal grandfather, paternal grandmother and paternal grandfather, which combines both the information of ?cross? and ?line? and should avoid the problem of the unbalanced design. Again, after attaching the data I have been using the following commands:
names(data)
?[1] "mat_granm" ?"mat_granf" "pat_granm" ?"pat_granf" ?"forigin" ?"morigin" ?"eggs" ?"adults"
y<-cbind(adults,eggs-adults)
model1<-lmer(y~mat_granm*mat_granf*pat_granm*pat_granf+(1|forigin)+(1|morigin),family=binomial)
This again doesn?t work, but instead of getting an error message, R hangs itself up every time I attempt the analysis (I left it over night to see if it would just take that long, but the program doesn?t react). Any help would be greatly appreciated, and I would also be happy to make the data available for this purpose. Sol This email may be confidential and subject to legal privilege, it may not reflect the views of the University of Canterbury, and it is not guaranteed to be virus free. If you are not an intended recipient, please notify the sender immediately and erase all copies of the message and any attachments. Please refer to http://www.canterbury.ac.nz/emaildisclaimer for more information.
_______________________________________________ R-sig-mixed-models at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models