Hi Ben,
Another 2 questions: 
1) shall I consider the boundary issue (null:sigma=0, alternative: sigma>0) when conducting the analysis of deviance?
2) When comparing two nested models with random effect (One model contains an extra random term than the other), I can directly apply function anova().  In this case, does the anova output contain the consideration of boundary issue? or I need to do it by myself?
Thank you
Chun 
> From: r-sig-mixed-models-request@r-project.org
> Subject: R-sig-mixed-models Digest, Vol 81, Issue 24
> To: r-sig-mixed-models@r-project.org
> Date: Mon, 16 Sep 2013 23:14:44 +0200
> 
> Send R-sig-mixed-models mailing list submissions to
> 	r-sig-mixed-models@r-project.org
> 
> To subscribe or unsubscribe via the World Wide Web, visit
> 	https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
> or, via email, send a message with subject or body 'help' to
> 	r-sig-mixed-models-request@r-project.org
> 
> You can reach the person managing the list at
> 	r-sig-mixed-models-owner@r-project.org
> 
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of R-sig-mixed-models digest..."
> 
> 
> Today's Topics:
> 
>    1. gls for generalized linear model (ChenChun)
>    2. Re: gls for generalized linear model (Julia Sommerfeld)
>    3. Re: gls for generalized linear model (ChenChun)
>    4. Re: gls for generalized linear model (Ben Bolker)
>    5. Lack of Variation in Slopes (AvianResearchDivision)
>    6. Question on calculating the conflidence limits on the
>       intraclass correlation in a nested binomial mixed model
>       (Tom Wenseleers)
>    7. Re: Lack of Variation in Slopes (Ben Bolker)
> 
> 
> ----------------------------------------------------------------------
> 
> Message: 1
> Date: Mon, 16 Sep 2013 10:47:46 +0000
> From: ChenChun <talischen@hotmail.com>
> To: "r-sig-mixed-models@r-project.org"
> 	<r-sig-mixed-models@r-project.org>
> Subject: [R-sig-ME] gls for generalized linear model
> Message-ID: <DUB124-W22C61A034ED522933C336BAC260@phx.gbl>
> Content-Type: text/plain
> 
> Dear R users,
> I am fitting a GLMM model on survival:
> fit1 <- lmer(alive ~ treatment + (1 | expID), family = binomial, data = Data, REML = TRUE)
> I would like to test whether the random effect is significant. Normally for a linear model, I could test it against a model without random effect using gls, for instancegld(response ~ variable, data=..., method="REML"). However, it seems that gls does not support the generalized linear model (family = binomial). May I ask how I can test the random effect in this case?
> Thanks
> Regards,
> tiantian 		 	   		  
> 	[[alternative HTML version deleted]]
> 
> 
> ------------------------------
> 
> Message: 2
> Date: Mon, 16 Sep 2013 13:04:21 +0200
> From: Julia Sommerfeld <Julia.Sommerfeld@utas.edu.au>
> To: ChenChun <talischen@hotmail.com>
> Cc: "r-sig-mixed-models@r-project.org"
> 	<r-sig-mixed-models@r-project.org>
> Subject: Re: [R-sig-ME] gls for generalized linear model
> Message-ID:
> 	<CAOCHjhS5kd1kwOiaUs6zs-bpJd-iw=Ph_uXhWo6p5gEv8VMzew@mail.gmail.com>
> Content-Type: text/plain
> 
> Hi
> 
> 
> 2013/9/16 ChenChun <talischen@hotmail.com>
> 
> > Dear R users,
> > I am fitting a GLMM model on survival:
> > fit1 <- lmer(alive ~ treatment + (1 | expID), family = binomial, data =
> > Data, REML = TRUE)
> > I would like to test whether the random effect is significant. Normally
> > for a linear model, I could test it against a model without random effect
> > using gls, for instancegld(response ~ variable, data=..., method="REML").
> > However, it seems that gls does not support the generalized linear model
> > (family = binomial). May I ask how I can test the random effect in this
> > case?
> >
> 
> 
> 
> fit1 <- lmer(alive ~ treatment + (1 | expID), family = binomial, data =
> Data, REML = TRUE)
> 
> fit0 <- lmer(alive ~ treatment, family = binomial, data = Data, REML = TRUE)
> 
> anova(fit0, fit1)
> 
> This should work. The anova performs a Likelihood ratio test under 1df.
> 
> Julia
> 
> 
> 
> > Thanks
> > Regards,
> > tiantian
> >         [[alternative HTML version deleted]]
> >
> > _______________________________________________
> > R-sig-mixed-models@r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
> >
> 
> 	[[alternative HTML version deleted]]
> 
> 
> 
> ------------------------------
> 
> Message: 3
> Date: Mon, 16 Sep 2013 11:23:58 +0000
> From: ChenChun <talischen@hotmail.com>
> To: Julia Sommerfeld <julia.sommerfeld@utas.edu.au>
> Cc: "r-sig-mixed-models@r-project.org"
> 	<r-sig-mixed-models@r-project.org>
> Subject: Re: [R-sig-ME] gls for generalized linear model
> Message-ID: <DUB124-W57F8E965E0D3A2CE7F6E5AC260@phx.gbl>
> Content-Type: text/plain
> 
> Thanks for the reply. However, I've got the error message from 
> fit0 <- lmer(alive ~ treatment, family = binomial, data = Data, REML = TRUE)
> "Error in lmerFactorList(formula, fr, rmInt = FALSE, drop = FALSE) : No random effects terms specified in formula"
> seems that lmer can not accpet a non-random term formula. From: Julia.Sommerfeld@utas.edu.au
> Date: Mon, 16 Sep 2013 13:04:21 +0200
> Subject: Re: [R-sig-ME] gls for generalized linear model
> To: talischen@hotmail.com
> CC: r-sig-mixed-models@r-project.org
> 
> Hi
> 
> 
> 2013/9/16 ChenChun <talischen@hotmail.com>
> 
> 
> Dear R users,
> 
> I am fitting a GLMM model on survival:
> 
> fit1 <- lmer(alive ~ treatment + (1 | expID), family = binomial, data = Data, REML = TRUE)
> 
> I would like to test whether the random effect is significant. Normally for a linear model, I could test it against a model without random effect using gls, for instancegld(response ~ variable, data=..., method="REML"). However, it seems that gls does not support the generalized linear model (family = binomial). May I ask how I can test the random effect in this case?
> 
> 
> 
> 
> 
> fit1 <- lmer(alive ~ treatment + (1 | expID), family = binomial, data = Data, REML = TRUE)
> 
> fit0 <- lmer(alive ~ treatment, family = binomial, data = Data, REML = TRUE)
> 
> 
> 
> anova(fit0, fit1)
> 
> This should work. The anova performs a Likelihood ratio test under 1df.
> 
> Julia
> 
>  
> 
> 
> Thanks
> 
> Regards,
> 
> tiantian
> 
>         [[alternative HTML version deleted]]
> 
> 
> 
> _______________________________________________
> 
> R-sig-mixed-models@r-project.org mailing list
> 
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
> 
> 
> 
>  		 	   		  
> 	[[alternative HTML version deleted]]
> 
> 
> ------------------------------
> 
> Message: 4
> Date: Mon, 16 Sep 2013 13:35:59 +0000 (UTC)
> From: Ben Bolker <bbolker@gmail.com>
> To: r-sig-mixed-models@r-project.org
> Subject: Re: [R-sig-ME] gls for generalized linear model
> Message-ID: <loom.20130916T152819-663@post.gmane.org>
> Content-Type: text/plain; charset=us-ascii
> 
> ChenChun <talischen@...> writes:
> 
> > 
> 
>  [snip]
> 
> > 
> > 2013/9/16 ChenChun <talischen@...>
> > 
> > Dear R users,
> > 
> > I am fitting a GLMM model on survival:
> > 
> > fit1 <- lmer(alive ~ treatment + (1 | expID), 
> >  family = binomial, data = Data, REML = TRUE)
> > 
> > I would like to test whether the random effect is significant. 
> > Normally for a linear model, I could test it
> > against a model without random effect using gls, for instance
> > gld(response ~ variable, data=...,
> > method="REML"). However, it seems that gls does
> > not support the generalized 
> > linear model (family =
> > binomial). May I ask how I can test the random effect in this case?
> 
>   As I recall, in the current CRAN version of lme4 (<1.0), the deviances
> from glmer() are not commensurate with glm(), but in the new version (>=1.0)
> they are, so you could compare the deviances of 
> 
> fit1 <- glmer(alive ~ treatment + (1|expID), family=binomial, data=Data)
> 
> and
> 
> fit0 <- glm(alive ~treatment, family=binomial)
> 
> (at the moment there is no automatic anova() method that can handle
> this, although this could be added).
> 
>  One comment and one question:
> 
> * REML does nothing in glmer()
> * are you sure it makes sense to test the statistical significance of
> the random effect?
> 
> 
> 
> ------------------------------
> 
> Message: 5
> Date: Mon, 16 Sep 2013 10:56:28 -0400
> From: AvianResearchDivision <segerfan83@gmail.com>
> To: r-sig-mixed-models@r-project.org
> Subject: [R-sig-ME] Lack of Variation in Slopes
> Message-ID:
> 	<CAHe08Sh4Ct-RFrZjLCcywhqYWjemYwvtvLDNCF2Cc+PfkMsFJQ@mail.gmail.com>
> Content-Type: text/plain
> 
> Hi all,
> 
> I have a very perplexing issue that I can't solve.  I am running a model
> that resembles the following:
> 
> model.lmer<-lmer(A~B*C+(B+0|Male)+(1|Male)
> 
> A--continuous response variable
> B--continuous, grand mean centered predictor variable
> C--Factor with 11 levels
> Male--Factor with 33 levels
> 
> When I check coef(model.lmer), the results under column B (i.e. slope) are
> the same across all 33 males.  This does not make any sense to me.  When I
> change the response variable to anything else other than A, I see variation
> in the slopes.  This goes for my 2012 data set only.  When I run my 2011
> data using the same exact model from above, but referencing the 2011 data
> frame, I see variation in slopes.  Finally, when I swap the data for C from
> 2011 to C for 2012, I also see variation in slopes.
> 
>  For whatever reason, I can't figure out what is going on with the 2012
> data set.  I have checked and rechecked my data in excel.  I have also
> exported the data as a .txt file and reimported it back into excel and that
> hasn't fixed anything.  There is absolutely no reason that I can think of
> for this to occur.  Any ideas?
> 
> Jacob
> 
> 	[[alternative HTML version deleted]]
> 
> 
> 
> ------------------------------
> 
> Message: 6
> Date: Mon, 16 Sep 2013 16:45:42 +0000
> From: Tom Wenseleers <Tom.Wenseleers@bio.kuleuven.be>
> To: "r-sig-mixed-models@r-project.org"
> 	<r-sig-mixed-models@r-project.org>
> Subject: [R-sig-ME] Question on calculating the conflidence limits on
> 	the intraclass correlation in a nested binomial mixed model
> Message-ID:
> 	<37EFC97028F3E44082ACC5CBEC005630112D5341@ICTS-S-MBX13.luna.kuleuven.be>
> 	
> Content-Type: text/plain
> 
> Dear all,
> I calculated the intraclass correlations at two nested levels in a binomial mixed model from the random effect variances, and tried to calculate the 95% confidence limits on them from the confidence limits on the variance components, obtained by profiling the likelihood:
> (I have 2 groups and ca 10 subgroups per group)
> 
>   fit = glmer(trait ~ 1 + (1|group/subgroup), family = binomial(link="logit"),data=mydata)
>   vcomps = as.numeric(VarCorr(fit))
>   V.link = (pi^2)/3
>   V.tot= vcomps [1] + vcomps [2] + V.link
>   ICC.group = results[2]/V.tot
>   ICC.subgroup = results[1]/V.tot
>  icc=c(ICC.group,ICC.subgroup)
> 
>   pr=profile(fit,signames=F)
>   prclims=(confint(pr,level=level)^2)/V.tot
>   low=prclims[2:1,1] # upper and lower CIs on the ICCs
>   up=prclims[2:1,2]
>   results = round(data.frame(icc, low, up),3)
>   row.names(results) = c("group", "subgroup")
>   results
> #                 icc        low    up
> # group    0.000    0.000   Inf
> # subgroup 0.095 0.006 0.303
> 
> My question is whether this approach would be OK? I only consider the uncertainty in the estimation of the among-group and among-subgroup variances here, keeping the total variance constant. Is that OK? And what is the implicit assumption in calculating the confidence limits this way - e.g. what sources of uncertainty are considered then? (I also came across this reference, https://stuiterproxy.kuleuven.be/doi/abs/10.1080/,DanaInfo=www.tandfonline.com+03610910903324834, about calculating the conf lims on the ICC using likelihood profiling, not sure if that is relevant here).
> 
> I also tried calculating the confidence limits using parametric bootstrapping (using bootMer), but there I ran into problems with non convergence in the fits, owing to the small size of my dataset. And then I tried nonparametric cluster bootstrapping, whereby I resampled over subgroups (resampling the same nr of subgroups pers groups as I had initially), but I am not sure that that is entirely correct either (e.g. it doesn't take into account the binomial scatter per subgroup cluster, and also resampling within clusters biases my estimate, so I can't do that). Or does anyone perhaps happen to have other ideas about how to calculate confidence limits on my estimated intraclass correlation?
> 
> Cheers,
> Tom
> 
> 
> _______________________________________________________________________________________
> 
> Prof. Tom Wenseleers
> *      Lab. of Socioecology and Social Evolution
>            Dept. of Biology
>            Zoological Institute
>            K.U.Leuven
>            Naamsestraat 59, box 2466
>            B-3000 Leuven
>            Belgium
> * +32 (0)16 32 39 64 / +32 (0)472 40 45 96
> * tom.wenseleers@bio.kuleuven.be
> http://bio.kuleuven.be/ento/wenseleers/twenseleers.htm
> 
> 
> 
> 	[[alternative HTML version deleted]]
> 
> 
> 
> ------------------------------
> 
> Message: 7
> Date: Mon, 16 Sep 2013 21:14:10 +0000 (UTC)
> From: Ben Bolker <bbolker@gmail.com>
> To: r-sig-mixed-models@r-project.org
> Subject: Re: [R-sig-ME] Lack of Variation in Slopes
> Message-ID: <loom.20130916T225118-122@post.gmane.org>
> Content-Type: text/plain; charset=us-ascii
> 
> AvianResearchDivision <segerfan83@...> writes:
> 
> > 
> > Hi all,
> > 
> > I have a very perplexing issue that I can't solve.  I am running a model
> > that resembles the following:
> > 
> > model.lmer<-lmer(A~B*C+(B+0|Male)+(1|Male)
> > 
> > A--continuous response variable
> > B--continuous, grand mean centered predictor variable
> > C--Factor with 11 levels
> > Male--Factor with 33 levels
> > 
> > When I check coef(model.lmer), the results under column B (i.e. slope) are
> > the same across all 33 males.  This does not make any sense to me.  When I
> > change the response variable to anything else other than A, I see variation
> > in the slopes.  This goes for my 2012 data set only.  When I run my 2011
> > data using the same exact model from above, but referencing the 2011 data
> > frame, I see variation in slopes.  Finally, when I swap the data for C from
> > 2011 to C for 2012, I also see variation in slopes.
> > 
> >  For whatever reason, I can't figure out what is going on with the 2012
> > data set.  I have checked and rechecked my data in excel.  I have also
> > exported the data as a .txt file and reimported it back into excel and that
> > hasn't fixed anything.  There is absolutely no reason that I can think of
> > for this to occur.  Any ideas?
> 
>   I strongly suspect that the problem is that the estimated random
> effects variation in the slope of A with respect to B across Males is
> zero.  This happens with some regularity, especially for relatively
> small data sets, or complex models.  You're estimating a lot of
> variation in B in the fixed effects (interaction with the 11-level factor 
> C), so it doesn't shock me that under some circumstances you get
> a zero estimate for sigma^2_(B|Male).
> 
> You can easily test this explanation by looking at the summary(), or VarCorr(),
> to see if that variance component is zero (or very small).
> 
>  Ben Bolker
> 
> 
> 
> ------------------------------
> 
> _______________________________________________
> R-sig-mixed-models mailing list
> R-sig-mixed-models@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
> 
> 
> End of R-sig-mixed-models Digest, Vol 81, Issue 24
> **************************************************
 		 	   		  
	[[alternative HTML version deleted]]

