Luisa Carvalheiro
2010-Feb-16 10:20 UTC
[R] lmer - error asMethod(object) : matrix is not symmetric
Dear R-help, I am having problems using package lme4. I am trying to analyse the effect of a continuous variable (Dist_NV) on a count data response variable (SR_SUN) using Poisson error distribution. However, when I run the model: summary(lmer((SR_SUN)~Dist_NV + (1|factor(Farm_code)) , family=poisson, REML=FALSE)) 1 error message and 1 warning message show up: in asMethod(object) : matrix is not symmetric [1,2] In addition: Warning message: In mer_finalize(ans) : singular convergence (7) A model including Dist_NV together with other variables runs with no problems. What am I doing wrong? Thank you, Luisa
Luisa Carvalheiro
2010-Feb-16 10:39 UTC
[R] lmer - error asMethod(object) : matrix is not symmetric
Dear R users, I am having problems using package lme4. I am trying to analyse the effect of a continuous variable (Dist_NV) on a count data response variable (SR_SUN) using Poisson error distribution. However, when I run the model: summary(lmer((SR_SUN)~Dist_NV + (1|factor(Farm_code)) , family=poisson, REML=FALSE)) 1 error message and 1 warning message show up: in asMethod(object) : matrix is not symmetric [1,2] In addition: Warning message: In mer_finalize(ans) : singular convergence (7) A model including Dist_NV together with other variables runs with no problems. What am I doing wrong? Thank you, Luisa -- Luisa Carvalheiro, PhD Southern African Biodiversity Institute, Kirstenbosch Research Center, Claremont & University of Pretoria Postal address - SAWC Pbag X3015 Hoedspruit 1380, South Africa telephone - +27 (0) 790250944 Carvalheiro at sanbi.org lgcarvalheiro at gmail.com
Douglas Bates
2010-Feb-16 15:35 UTC
[R] lmer - error asMethod(object) : matrix is not symmetric
This is similar to another question on the list today. On Tue, Feb 16, 2010 at 4:39 AM, Luisa Carvalheiro <lgcarvalheiro at gmail.com> wrote:> Dear R users, > > I ?am having problems using package lme4. > > I am trying to analyse the effect of a continuous variable (Dist_NV) > on a count data response variable (SR_SUN) using Poisson error > distribution. However, when I run the model: > > summary(lmer((SR_SUN)~Dist_NV + (1|factor(Farm_code)) , > family=poisson, REML=FALSE)) > > 1 error message and 1 warning message show up: > > in asMethod(object) : matrix is not symmetric [1,2] > In addition: Warning message: > In mer_finalize(ans) : singular convergence (7)So the first thing to do is to include the optional argument verbose TRUE in the call to lmer. (Also, REML = FALSE is ignored for Generalized Linear Mixed Models and can be omitted. although there is no harm in including it.) You need to know where the optimizer is taking the parameter values before you can decide why. P.S. Questions like this will probably be more readily answered on the R-SIG-Mixed-Models mailing list.> A model including ?Dist_NV together with other variables runs with no problems. > What am I doing wrong? > > Thank you, > > Luisa > > > -- > Luisa Carvalheiro, PhD > Southern African Biodiversity Institute, Kirstenbosch Research Center, Claremont > & University of Pretoria > Postal address - SAWC Pbag X3015 Hoedspruit 1380, South Africa > telephone - +27 (0) 790250944 > Carvalheiro at sanbi.org > lgcarvalheiro at gmail.com > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >
Luisa Carvalheiro
2010-Feb-16 16:54 UTC
[R] lmer - error asMethod(object) : matrix is not symmetric
Dear Douglas, Thank you for your reply. Just some extra info on the dataset: In my case Number of obs is 33, and number of groups of factor(Farm_code) is 12. This is the information on iterations I get: summary(lmer(round(SR_SUN)~Dist_NV + (1|factor(Farm_code)) , family=poisson, verbose =TRUE)) 0: 60.054531: 1.06363 2.14672 -0.000683051 1: 60.054531: 1.06363 2.14672 -0.000683051 Error in asMethod(object) : matrix is not symmetric [1,2] In addition: Warning message: In mer_finalize(ans) : singular convergence (7) When I run a similar model (exp variable Dist_hives) the number of iterations is 11: summary(lmer(round(SR_SUN)~Dist_hives + (1|factor(Farm_code)) , family=poisson, verbose =TRUE)) 0: 61.745238: 0.984732 1.63769 0.000126484 1: 61.648229: 0.984731 1.63769 -2.08637e-05 2: 61.498777: 0.984598 1.63769 4.11867e-05 3: 47.960908: 0.381062 1.63585 6.77029e-05 4: 46.223789: 0.250732 1.66727 8.31854e-05 5: 46.222223: 0.250732 1.66727 6.97790e-05 6: 46.216710: 0.250730 1.66727 7.60560e-05 7: 46.168835: 0.230386 1.64883 9.16430e-05 8: 46.165955: 0.228062 1.65658 8.70694e-05 9: 46.165883: 0.228815 1.65737 8.63400e-05 10: 46.165883: 0.228772 1.65734 8.63698e-05 11: 46.165883: 0.228772 1.65734 8.63701e-05 I am very confused with the fact that it runs with Dist_hives and not with Dist_NV. Both variables are distance values, the first having no obvious relation with the response variable and the second (Dist_NV) seems to have a negative effect on SR_SUN. Does this information helps identifying the problem with my data/analysis? Thank you, Luisa On Tue, Feb 16, 2010 at 5:35 PM, Douglas Bates <bates at stat.wisc.edu> wrote:> This is similar to another question on the list today. > > On Tue, Feb 16, 2010 at 4:39 AM, Luisa Carvalheiro > <lgcarvalheiro at gmail.com> wrote: >> Dear R users, >> >> I ?am having problems using package lme4. >> >> I am trying to analyse the effect of a continuous variable (Dist_NV) >> on a count data response variable (SR_SUN) using Poisson error >> distribution. However, when I run the model: >> >> summary(lmer((SR_SUN)~Dist_NV + (1|factor(Farm_code)) , >> family=poisson, REML=FALSE)) >> >> 1 error message and 1 warning message show up: >> >> in asMethod(object) : matrix is not symmetric [1,2] >> In addition: Warning message: >> In mer_finalize(ans) : singular convergence (7) > > So the first thing to do is to include the optional argument verbose > TRUE in the call to lmer. ?(Also, REML = FALSE is ignored for > Generalized Linear Mixed Models and can be omitted. although there is > no harm in including it.) > > You need to know where the optimizer is taking the parameter values > before you can decide why. > > P.S. Questions like this will probably be more readily answered on the > R-SIG-Mixed-Models mailing list. > >> A model including ?Dist_NV together with other variables runs with no problems. >> What am I doing wrong? >> >> Thank you, >> >> Luisa >> >> >> -- >> Luisa Carvalheiro, PhD >> Southern African Biodiversity Institute, Kirstenbosch Research Center, Claremont >> & University of Pretoria >> Postal address - SAWC Pbag X3015 Hoedspruit 1380, South Africa >> telephone - +27 (0) 790250944 >> Carvalheiro at sanbi.org >> lgcarvalheiro at gmail.com >> >> ______________________________________________ >> R-help at r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. >> >-- Luisa Carvalheiro, PhD Southern African Biodiversity Institute, Kirstenbosch Research Center, Claremont & University of Pretoria Postal address - SAWC Pbag X3015 Hoedspruit 1380, South Africa telephone - +27 (0) 790250944 Carvalheiro at sanbi.org lgcarvalheiro at gmail.com
Douglas Bates
2010-Feb-16 19:17 UTC
[R] lmer - error asMethod(object) : matrix is not symmetric
On Tue, Feb 16, 2010 at 10:54 AM, Luisa Carvalheiro <lgcarvalheiro at gmail.com> wrote:> Dear Douglas, > > Thank you for your reply. > Just some extra info on the dataset: In my case Number of obs is 33, > and number of groups of factor(Farm_code) is 12. > This is the information on iterations I get: > > summary(lmer(round(SR_SUN)~Dist_NV + (1|factor(Farm_code)) , > family=poisson, verbose =TRUE)) > ?0: ? ? 60.054531: ?1.06363 ?2.14672 -0.000683051 > ?1: ? ? 60.054531: ?1.06363 ?2.14672 -0.000683051 > Error in asMethod(object) : matrix is not symmetric [1,2] > In addition: Warning message: > In mer_finalize(ans) : singular convergence (7)> When I run a similar model (exp variable Dist_hives) the number of > iterations is 11:> ?summary(lmer(round(SR_SUN)~Dist_hives + (1|factor(Farm_code)) , > family=poisson, verbose =TRUE)) > ?0: ? ? 61.745238: 0.984732 ?1.63769 0.000126484 > ?1: ? ? 61.648229: 0.984731 ?1.63769 -2.08637e-05 > ?2: ? ? 61.498777: 0.984598 ?1.63769 4.11867e-05 > ?3: ? ? 47.960908: 0.381062 ?1.63585 6.77029e-05 > ?4: ? ? 46.223789: 0.250732 ?1.66727 8.31854e-05 > ?5: ? ? 46.222223: 0.250732 ?1.66727 6.97790e-05 > ?6: ? ? 46.216710: 0.250730 ?1.66727 7.60560e-05 > ?7: ? ? 46.168835: 0.230386 ?1.64883 9.16430e-05 > ?8: ? ? 46.165955: 0.228062 ?1.65658 8.70694e-05 > ?9: ? ? 46.165883: 0.228815 ?1.65737 8.63400e-05 > ?10: ? ? 46.165883: 0.228772 ?1.65734 8.63698e-05 > ?11: ? ? 46.165883: 0.228772 ?1.65734 8.63701e-05> I am very confused with the fact that it runs with Dist_hives and not > with Dist_NV. Both variables are distance values, the first having no > obvious relation with the response variable and the second (Dist_NV) > seems to have a negative effect on SR_SUN.As you say, Dist_hives has very little relationship to the response variable. The two fixed-effects coefficients are the last two parameters in the iteration output (the first parameter is the standard deviation of the random effects). So the slope with respect to Dist_hives for the linear predictor is 0.0000863. Either you have very large magnitudes of Dist_hives or that variable does not have much predictive power. For the second (Dist_NV) variable, the optimization algorithm is not able to make progress from the starting estimates. This may be an indication that the problem is badly scaled. Are the values of Dist_NV very large? If so, you may want to change the unit (say from meters to kilometers) so the values are much smaller. It may also help to use a starting estimate for the standard deviation of the random effects derived from the other model. That is, include start = 0.22 in the call to lmer.> Does this information helps identifying the problem with my data/analysis? > > Thank you, > > Luisa > > > > > On Tue, Feb 16, 2010 at 5:35 PM, Douglas Bates <bates at stat.wisc.edu> wrote: >> This is similar to another question on the list today. >> >> On Tue, Feb 16, 2010 at 4:39 AM, Luisa Carvalheiro >> <lgcarvalheiro at gmail.com> wrote: >>> Dear R users, >>> >>> I ?am having problems using package lme4. >>> >>> I am trying to analyse the effect of a continuous variable (Dist_NV) >>> on a count data response variable (SR_SUN) using Poisson error >>> distribution. However, when I run the model: >>> >>> summary(lmer((SR_SUN)~Dist_NV + (1|factor(Farm_code)) , >>> family=poisson, REML=FALSE)) >>> >>> 1 error message and 1 warning message show up: >>> >>> in asMethod(object) : matrix is not symmetric [1,2] >>> In addition: Warning message: >>> In mer_finalize(ans) : singular convergence (7) >> >> So the first thing to do is to include the optional argument verbose >> TRUE in the call to lmer. ?(Also, REML = FALSE is ignored for >> Generalized Linear Mixed Models and can be omitted. although there is >> no harm in including it.) >> >> You need to know where the optimizer is taking the parameter values >> before you can decide why. >> >> P.S. Questions like this will probably be more readily answered on the >> R-SIG-Mixed-Models mailing list. >> >>> A model including ?Dist_NV together with other variables runs with no problems. >>> What am I doing wrong? >>> >>> Thank you, >>> >>> Luisa >>> >>> >>> -- >>> Luisa Carvalheiro, PhD >>> Southern African Biodiversity Institute, Kirstenbosch Research Center, Claremont >>> & University of Pretoria >>> Postal address - SAWC Pbag X3015 Hoedspruit 1380, South Africa >>> telephone - +27 (0) 790250944 >>> Carvalheiro at sanbi.org >>> lgcarvalheiro at gmail.com >>> >>> ______________________________________________ >>> R-help at r-project.org mailing list >>> https://stat.ethz.ch/mailman/listinfo/r-help >>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html >>> and provide commented, minimal, self-contained, reproducible code. >>> >> > > > > -- > Luisa Carvalheiro, PhD > Southern African Biodiversity Institute, Kirstenbosch Research Center, Claremont > & University of Pretoria > Postal address - SAWC Pbag X3015 Hoedspruit 1380, South Africa > telephone - +27 (0) 790250944 > Carvalheiro at sanbi.org > lgcarvalheiro at gmail.com >