[R-sig-ME] help for HLM

Douglas Bates bates at stat.wisc.edu
Wed Sep 5 21:39:59 CEST 2012


The important part of this output is the line Number of groups: 2

You are trying to estimate three variance-covariance parameters with
only two levels of Trip.  You would need many levels of Trip to be
able to do so.

When you have only two levels of a categorical variable you must model
it with fixed-effects parameters even though from the structure of the
experiment it may seem reasonable to use random effects.

On Wed, Sep 5, 2012 at 1:45 PM, Karina Villegas <villegaskary at gmail.com> wrote:
> *Dear R experts:*
> *
> *
> *I am running R version 2.12.1 on Windows 2007. I am studying the effects
> maternal behavior in the body condition of sea lion pups from California. *
>
> *
> *
>
> *I'm trying to make a hierarchical linear model*
>
> *When I run the full model if I get these results:*
>
> *> LevelModel7 <- lme(PBC ~ Sex*Dur.nurse + Sex*Freq.interaction +
> Sex*Density.females , random=~Sex|Trip, data=Dataset)*
>
> *> summary (LevelModel7)*
>
> *Linear mixed-effects model fit by REML*
>
> * Data: Dataset*
>
> *       AIC      BIC    logLik*
>
> *  446.1461 478.1074 -211.0730*
>
> * *
>
> *Random effects:*
>
> * Formula: ~Sex | Trip*
>
> * Structure: General positive-definite, Log-Cholesky parametrization*
>
> *            StdDev    Corr *
>
> *(Intercept) 0.5250613 (Intr)*
>
> *Sex         0.0614132 0    *
>
> *Residual    1.4865472      *
>
> * *
>
> *Fixed effects: PBC ~ Sex * Dur.nurse + Sex * Freq.interaction + Sex *
> Density.females*
>
> *                         Value Std.Error  DF    t-value p-value*
>
> *(Intercept)            3.32002 13.521223 105  0.2455415  0.8065*
>
> *Sex                    0.76586  1.584268 105  0.4834144  0.6298*
>
> *Dur.nurse              1.95957  1.798351 105  1.0896502  0.2784*
>
> *Freq.interaction      -0.22624  0.219637 105 -1.0300505  0.3054*
>
> *Density.females      -32.19456 19.335512 105 -1.6650480  0.0989*
>
> *Sex:Dur.nurse         -0.21788  0.209796 105 -1.0385351  0.3014*
>
> *Sex:Freq.interaction   0.02165  0.025693 105  0.8426169  0.4014*
>
> *Sex:Density.females    3.15918  2.258348 105  1.3988881  0.1648*
>
> * Correlation:*
>
> *                     (Intr) Sex    Dr.nrs Frq.nt Dnsty. Sx:Dr. Sx:Fr.*
>
> *Sex                  -0.998                                         *
>
> *Dur.nurse            -0.928  0.924                                  *
>
> *Freq.interaction     -0.194  0.195  0.103                           *
>
> *Density.females       0.613 -0.609 -0.809 -0.346                    *
>
> *Sex:Dur.nurse         0.928 -0.928 -0.996 -0.109  0.802             *
>
> *Sex:Freq.interaction  0.196 -0.198 -0.108 -0.994  0.353  0.108      *
>
> *Sex:Density.females  -0.611  0.609  0.802  0.354 -0.991 -0.807 -0.350*
>
> * *
>
> *Standardized Within-Group Residuals:*
>
> *        Min          Q1         Med          Q3         Max*
>
> *-2.46806088 -0.47865795 -0.05134942  0.57369682  2.64445772*
>
> * *
>
> *Number of Observations: 114*
>
> *Number of Groups: 2*
>
> * *
>
> *When I run simple models (one variable included: females Density,
>  Frequency interaction) I have no problem either.*
>
> * *
>
> *> LevelModel3 <- lme(PBC ~ Sex*Density.females , random=~Sex|Trip,
> data=Dataset)*
>
> *> summary (LevelModel3)*
>
> *Linear mixed-effects model fit by REML*
>
> * Data: Dataset*
>
> *       AIC      BIC    logLik*
>
> *  428.5119 450.1158 -206.2560*
>
> * *
>
> *Random effects:*
>
> * Formula: ~Sex | Trip*
>
> * Structure: General positive-definite, Log-Cholesky parametrization*
>
> *            **StdDev       Corr *
>
> *(Intercept) 1.076517e+00 (Intr)*
>
> *Sex         5.258193e-05 0    *
>
> *Residual    1.489254e+00      *
>
> * *
>
> *Fixed effects: PBC ~ Sex * Density.females*
>
> *                         Value Std.Error  DF   t-value p-value*
>
> *(Intercept)          14.774095  4.876298 109  3.029777  0.0031*
>
> *Sex                  -0.646479  0.566328 109 -1.141528  0.2562*
>
> *Density.females     -18.980461 10.099637 109 -1.879321  0.0629*
>
> *Sex:Density.females   1.892986  1.185115 109  1.597302  0.1131*
>
> * Correlation:*
>
> *                    (Intr) Sex    Dnsty.*
>
> *Sex                 -0.984             *
>
> *Density.females     -0.857  0.862      *
>
> *Sex:Density.females  0.855 -0.869 -0.995*
>
> * *
>
> *Standardized Within-Group Residuals:*
>
> *         Min           Q1          Med           Q3          Max*
>
> *-2.678669640 -0.591855777  0.006108111  0.543417969  2.424555266*
>
> * *
>
> *Number of Observations: 114*
>
> *Number of Groups: 2*
>
>
>
> *> LevelModel4 <- lme(PBC ~ Sex*Freq.interaction , random=~Sex|Trip,
> data=Dataset)*
>
> *> summary (LevelModel4)*
>
> *Linear mixed-effects model fit by REML*
>
> * Data: Dataset*
>
> *       AIC      BIC    logLik*
>
> *  451.1833 472.7872 -217.5917*
>
> * *
>
> *Random effects:*
>
> * Formula: ~Sex | Trip*
>
> * Structure: General positive-definite, Log-Cholesky parametrization*
>
> *            **StdDev       Corr *
>
> *(Intercept) 1.934101e+00 (Intr)*
>
> *Sex         3.442453e-05 0    *
>
> *Residual    1.527767e+00      *
>
> * *
>
> *Fixed effects: PBC ~ Sex * Freq.interaction*
>
> *                         Value Std.Error  DF   t-value p-value*
>
> *(Intercept)          12.595151  4.211533 109  2.990633  0.0034*
>
> *Sex                  -0.535742  0.465667 109 -1.150484  0.2525*
>
> *Freq.interaction     -0.334393  0.199095 109 -1.679564  0.0959*
>
> *Sex:Freq.interaction  0.039834  0.023241 109  1.713935  0.0894*
>
> * Correlation:*
>
> *                     (Intr) Sex    Frq.nt*
>
> *Sex                  -0.943             *
>
> *Freq.interaction     -0.745  0.783      *
>
> *Sex:Freq.interaction  0.743 -0.788 -0.996*
>
> * *
>
> *Standardized Within-Group Residuals:*
>
> *        Min          Q1         Med          Q3         Max*
>
> *-2.79224714 -0.46765869 -0.04400343  0.66192444  2.53486123*
>
> * *
>
> *Number of Observations: 114*
>
> *Number of Groups: 2*
>
> * *
>
> * *
>
> *However, when I include only variable Dur.nurse, I get the following error
> message:*
>
>> LevelModel2 <- lme(PBC ~ Sex*Dur.nurse, random=~Sex|Trip, data=Dataset)
>
> Error in lme.formula(PBC ~ Sex * Dur.nurse, random = ~Sex | Trip, data =
> Dataset) :
>
>   nlminb problem, convergence error code = 1
>
>   message = iteration limit reached without convergence (9)
>
>
>
> *We thought it was a problem with the number of iterations and I increased
> the iterations, but I still get the error:*
>
>> LevelModel1 <- lme(PBC ~ Sex*Dur.nurse, random=~Sex|Trip, data=Dataset,
> control=lmeControl(maxIter=200))
>
> Error in lme.formula(PBC ~ Sex * Dur.nurse, random = ~Sex | Trip, data =
> Dataset,  :
>
>   nlminb problem, convergence error code = 1
>
>   message = iteration limit reached without convergence (9)
>
>
>
> *Somebody has any idea?*
>
>
>
> *Thanks and regards*
>
> *Karina*
>
> --
> Biol. Karina Villegas Cervantes
> Estudiante de Maestría PCMyL - UNAM
>
> Laboratorio de Ecologia de Pinnipedos Burney J. Le Boueuf.
> CICIMAR-IPN
> Av. Instituto Politecnico Nacional s/n.Col.Playa Palo de Santa Rita
> La Paz Baja California Sur, Mexico.
>
>         [[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