[ADMB Users] Function Maximizer Failed in glmmADMB using Beta Distribution
Ben Bolker
bbolker at gmail.com
Fri Dec 9 10:56:13 PST 2011
On 11-12-09 08:16 PM, dave fournier wrote:
> Try running it from outside R. It appears to work for me that way.
> Of course I'm not saddled with a MAC.
> _______________________________________________
> Users mailing list
> Users at admb-project.org
> http://lists.admb-project.org/mailman/listinfo/users
The problem is apparently with some of the extra arguments that we
decided to use in glmmADMB, in particular -shess -noinit. If you
turn these off by adding admb.opts=admbControl(shess=FALSE,noinit=FALSE)
then glmmADMB gets all the way through, albeit with some warnings in
one case.
On the other hand, you get almost the same answer by averaging the
Admix value by lake (which is fairly reasonable since the predictor
variables are constant per lake) and running a quasibinomial model
(which is a quick/cheesy way to get a variance proportional to p*(1-p)
and a logistic curve with respect to the predictors) ...
Watch out for bogus line breaks below.
adat <- read.table("admix_small_data.txt",header=TRUE, na.strings="na")
library(MASS)
library(glmmADMB)
adat <- transform(adat,Lake=reorder(Lake,Admix))
library(reshape)
am <- melt(adat,id.var=c("Lake","Admix"))
library(ggplot2)
g1 <-
ggplot(am,aes(x=value,y=Admix,colour=Lake))+facet_grid(.~variable,scale="free")+
geom_smooth(aes(group=1),method="glm",family="binomial")+theme_bw()+
scale_colour_manual(breaks=levels(am$Lake),
value=colorRampPalette(colors=c("red","blue"))(length(levels(am$Lake))))
g1 + geom_boxplot()
g1 + stat_summary(fun.data="mean_cl_boot")
glmm4<-glmmadmb(formula = Admix ~ SDI + (1|Lake), data = adat, family =
"beta",
admb.opts=admbControl(shess=FALSE,noinit=FALSE))
glmm4<-glmmadmb(formula = Admix ~ SDI + (1|Lake), data = adat, family =
"beta",
save.dir="gtmp",admb.opts=admbControl(run=FALSE))
glmm4B <- glmmadmb(formula = Admix ~ SDI + (1|Lake), data = adat, family
= "beta",
save.dir="gtmp",admb.opts=admbControl(run=FALSE))
glmm8<-glmmadmb(formula = Admix ~ pH + (1|Lake), data = adat, family =
"beta")
glmm8 <- glmmadmb(formula = Admix ~ pH + (1|Lake), data = adat, family =
"beta",
admb.opts=admbControl(shess=FALSE,noinit=FALSE))
## warnings but finishes
glmm15<-glmmadmb(formula = Admix ~ StMonth + (1|Lake), data = adat,
family = "beta",
admb.opts=admbControl(shess=FALSE,noinit=FALSE))
glmmnew <-glmmadmb(formula = Admix ~ pH+ StMonth + SDI + (1|Lake), data
= adat, family = "beta",
admb.opts=admbControl(shess=FALSE,noinit=FALSE))
mdat <- ddply(adat,.(Lake),
function(x) { with(x,
data.frame(Lake=Lake[1],
pH=pH[1],
StMonth=StMonth[1],
SDI=SDI[1], Admix=mean(Admix)))})
m2 <- glm(Admix~pH+StMonth+SDI,data=mdat,family=quasibinomial())
library(betareg)
m4 <- betareg(Admix~pH+StMonth+SDI,data=mdat) ## hmmm.
library(coefplot2)
coefplot2(list(glmmnew,m2))
More information about the Users
mailing list