[R-sig-ME] help for lemr
Douglas Bates
bates at stat.wisc.edu
Thu Apr 3 16:13:37 CEST 2008
Could you tell us which version of the lme4 package you are using, please? Use
sessionInfo()
to get that information. If you haven't already done so it may be
worthwhile trying the development version obtainable by
install.packages("lme4", repos = "http://r-forge.r-project.org/")
On Thu, Apr 3, 2008 at 8:32 AM, Claudie Desroches
<claudie.desroches at usherbrooke.ca> wrote:
> To whom who can help me!
>
>
>
> I want to run an lmer with a Poisson distribution because it is abundance
> data (discrete data)named "ind_total".
>
> I have a nested structure which is "observations" within "localisation"
> within "site"
>
> The lme function would be: y~x1+x2+x3+random=1|site/localisation, data)
>
>
>
> Actually, with lmer function I tried :
> model_2_lmer<-lmer(ind_total~1+(1|site:localisation)+(1|site),data=donnees,m
> ethod="Laplace",family=poisson(link = "log"),na.action=na.omit)
>
> And a warning message appears saying:
>
>
>
> Error in lmerFactorList(formula, mf, fltype) :
>
> number of levels in grouping factor(s) 'site' is too large
>
> Warning messages:
>
> 1: In site:localisation :
>
> l'expression numérique a 1278 éléments : seul le premier est utilisé
> (numerical expression has 1278 elements : only first is used)
>
> 2: In site:localisation :
>
> l'expression numérique a 1278 éléments : seul le premier est utilisé
> (numerical expression has 1278 elements : only first is used)
>
>
>
> So I tried
>
> model_3_lmer<-lmer(ind_total~1+(1|localisation)+(1|site),data=donnees,method
> ="Laplace",family=poisson(link = "log"),na.action=na.omit)
>
> and it seems to work:
>
> Generalized linear mixed model fit using Laplace
>
> Formula: ind_total ~ 1 + (1 | localisation) + (1 | site)
>
> Data: donnees
>
> Family: poisson(log link)
>
> AIC BIC logLik deviance
>
> 1032 1048 -513.1 1026
>
> Random effects:
>
> Groups Name Variance Std.Dev.
>
> site (Intercept) 2.0538e-01 4.5319e-01
>
> localisation (Intercept) 5.0000e-10 2.2361e-05
>
> number of obs: 1278, groups: site, 40; localisation, 2
>
>
>
> Estimated scale (compare to 1 ) 0.7704331
>
>
>
> Fixed effects:
>
> Estimate Std. Error z value Pr(>|z|)
>
> (Intercept) 0.15660 0.07645 2.048 0.0405 *
>
>
>
> Is my nested structure written right?
>
>
>
> Then I tried to include all my covariates and a warning message appears
> again:
>
> model_4lmer<-lmer(ind_total~as.factor(annee)+temp+as.factor(pluie)+foret_tot
> +superf_reelle+foret_tot*superf_reelle+as.factor(localisation)+as.factor(pic
> )+axe_1+axe_2+as.factor(traitement)+as.factor(annee)*as.factor(traitement)+(
> 1|localisation)+(1|site),data=donnees,method="Laplace",family=poisson(link =
> "log"),na.action=na.omit)
>
> > summary(model_4lmer)
>
> Erreur dans asMethod(object) : matrix is not symmetric [1,2]
>
>
>
> I looked at my matrix and everything is ok… the only thing is I have 3 NAs
> in my response variable but I specified "na.action=na.omit"…What am I doing
> wrong!?!
>
> Thank you
>
> Claudie Desroches
>
> ------------
>
> Claudie Desroches
> étudiante au 2e cycle
> Chaire de recherche du Canada en écologie spatiale et en écologie du paysage
> Université de Sherbrooke: Département de Biologie
> 1-819-821-8000 poste 63468
> HYPERLINK
> "mailto:claudie.desroches at usherbrooke.ca"claudie.desroches at usherbrooke.ca
>
>
>
>
>
> Checked by AVG.
>
> 10:48
>
>
> [[alternative HTML version deleted]]
>
>
> _______________________________________________
> 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