[R-sig-ME] Specifying a (simple?) two level model
ONKELINX, Thierry
Thierry.ONKELINX at inbo.be
Fri Jul 1 13:07:11 CEST 2011
> -----Oorspronkelijk bericht-----
> Van: r-sig-mixed-models-bounces at r-project.org [mailto:r-sig-mixed-models-
> bounces at r-project.org] Namens Hans Ekbrand
> Verzonden: vrijdag 1 juli 2011 12:26
> Aan: r-sig-mixed-models at r-project.org
> Onderwerp: Re: [R-sig-ME] Specifying a (simple?) two level model
>
> On Thu, Jun 30, 2011 at 08:41:09AM +0000, ONKELINX, Thierry wrote:
> > Dear Hans,
> >
> > I would rather fit (0 + cluster|country). 1 + cluster will use the first cluster as
> reference and then calculate the differences for the other clusters. Whereas
> 0+cluster will directly estimate the effect of each cluster. Therefore the
> variance-covariance matrix of the random effect will be easier to interpret.
>
> I see. Thank you the help.
>
> > However with 22 clusters, the variance-covariance matrix will be 22x22. Which
> is large and thus takes time to fit.
> >
> > A second problem is that you have complete separation in your dataset:
> > some clusters in some countries have only 0 or only 1. That creates
> > numerical problems: logit(0) = -Inf and logit(1) = Inf
>
> Interesting, perhaps it will work if I correct that (exclude some contries, or
> merge some of smaller clusters).
I would focus on merging clusters. A smaller number of cluster will not only solve the problem om complete separation. You will get a smaller variance-covariance matrix for the random effects. That will speed up the fit as well.
>
> BTW, how did you notice?
Something like this
library(reshape)
cast(cluster ~ country, data = your.data.frame, value = "your.response", fun = mean)
sum(cast(cluster ~ country, data = your.data.frame, value = "your.response", fun = mean) %in% c(0, 1), na.rm = TRUE)
>
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
More information about the R-sig-mixed-models
mailing list