Dear all, This question is basic but I am stumped. After running the below, I receive the message: "non-integer #successes in a binomial glm!" model1 <- glmmML(y~Brood.Size*Density+Date.Placed+Species+Placed.Emerging+Year+rate.of.parperplot, data = data, cluster= data$Patch, family=binomial(link="logit")) My response variable is sex ratio, and I have learned quickly not to use proportion values as data. Instead, my response variable y is a 2 column matrix that looks like the following but with more rows. Column 1 would be number of males and column 2 would be number of females in a brood. [,1] [,2] [1,] 18 19 [2,] 7 37 [3,] 5 26 [4,] 4 16 [5,] 6 19 [6,] 4 15 [7,] 15 14 [8,] 15 29 All the numbers in both columns are integers. I am able to use this same format for my response variable when using the glmer() function with no problem. In the documentation for glmmML, it says "For the binomial families, the response can be a two-column matrix". Isn't that what I am using? Is it immediately obvious to anyone what is wrong with my input? Or perhaps I am doing something else wrong? Thanks so much in advance, Tom [[alternative HTML version deleted]]
On Jun 21, 2011, at 11:13 PM, Tom Kraft wrote:> Dear all, > > This question is basic but I am stumped. After running the below, I > receive > the message: "non-integer #successes in a binomial glm!"> > model1 <- > glmmML(y~Brood.Size*Density+Date.Placed+Species+Placed.Emerging+Year > +rate.of.parperplot, > data = data, cluster= data$Patch, family=binomial(link="logit")) > > My response variable is sex ratio, and I have learned quickly not to > use > proportion values as data. Instead, my response variable y is a 2 > column > matrix that looks like the following but with more rows. Column 1 > would be > number of males and column 2 would be number of females in a brood. > > [,1] [,2] > [1,] 18 19 > [2,] 7 37 > [3,] 5 26 > [4,] 4 16 > [5,] 6 19 > [6,] 4 15 > [7,] 15 14 > [8,] 15 29 > > All the numbers in both columns are integers.You have not demonstrated that this is so. You could have offered str(data) What happens if you first do: data$y <- as.integer(data$y) # ? (Sometimes floating points will be printed as though they were integers.)>-- David> I am able to use this same > format for my response variable when using the glmer() function with > no > problem. In the documentation for glmmML, it says "For the binomial > families, the response can be a two-column matrix". Isn't that what > I am > using? Is it immediately obvious to anyone what is wrong with my > input? Or > perhaps I am doing something else wrong? Thanks so much in advance, > > Tom > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.David Winsemius, MD West Hartford, CT
Tom, thanks for spotting a bug in glmmML; internally, glmmML sorts data by cluster. The bug is that I missed to sort the weights accordingly. Weights are produced when the response is a two-column matrix, as in your case. So, glmmML calls glm.fit with wrong weights, and the warning comes from that. Unfortunately, this also affects the rest of the fitting procedure. I will fix this asap. Meanwhile, a possible workaround: Sort your data.frame by cluster before calling glmmML. G?ran On Wed, Jun 22, 2011 at 5:13 AM, Tom Kraft <thomas.s.kraft at dartmouth.edu> wrote:> Dear all, > > This question is basic but I am stumped. After running the below, I receive > the message: "non-integer #successes in a binomial glm!" > > model1 <- > glmmML(y~Brood.Size*Density+Date.Placed+Species+Placed.Emerging+Year+rate.of.parperplot, > data = data, cluster= data$Patch, family=binomial(link="logit")) > > My response variable is sex ratio, and I have learned quickly not to use > proportion values as data. Instead, my response variable y is a 2 column > matrix that looks like the following but with more rows. Column 1 would be > number of males and column 2 would be number of females in a brood. > > ? ? ? ? [,1] ? ?[,2] > ?[1,] ? 18 ? 19 > ?[2,] ? ?7 ? 37 > ?[3,] ? ?5 ? 26 > ?[4,] ? ?4 ? 16 > ?[5,] ? ?6 ? 19 > ?[6,] ? ?4 ? 15 > ?[7,] ? 15 ? 14 > ?[8,] ? 15 ? 29 > > All the numbers in both columns are integers. I am able to use this same > format for my response variable when using the glmer() function with no > problem. In the documentation for glmmML, it says "For the binomial > families, the response can be a two-column matrix". Isn't that what I am > using? Is it immediately obvious to anyone what is wrong with my input? Or > perhaps I am doing something else wrong? Thanks so much in advance, > > Tom > > ? ? ? ?[[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >-- G?ran Brostr?m