[R-sig-ME] R^2 for linear mixed effects models with glmer()

Thierry Onkelinx thierry.onkelinx at inbo.be
Wed Feb 7 09:38:17 CET 2018


Dear Alexandre,

The str() is not on the same dataset that is used in the model. One
has 288 observations, the other 72.

Furthermore look at the correlation among the covariates. I expect
that the issues are due to strong collinearity.

Best regards,


ir. Thierry Onkelinx
Statisticus / Statistician

Vlaamse Overheid / Government of Flanders
INSTITUUT VOOR NATUUR- EN BOSONDERZOEK / RESEARCH INSTITUTE FOR NATURE
AND FOREST
Team Biometrie & Kwaliteitszorg / Team Biometrics & Quality Assurance
thierry.onkelinx at inbo.be
Havenlaan 88 bus 73, 1000 Brussel
www.inbo.be

///////////////////////////////////////////////////////////////////////////////////////////
To call in the statistician after the experiment is done may be no
more than asking him to perform a post-mortem examination: he may be
able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher
The plural of anecdote is not data. ~ Roger Brinner
The combination of some data and an aching desire for an answer does
not ensure that a reasonable answer can be extracted from a given body
of data. ~ John Tukey
///////////////////////////////////////////////////////////////////////////////////////////




2018-02-06 20:33 GMT+01:00 ASANTOS <alexandresantosbr at yahoo.com.br>:
> Thanks Thierry,
>
>        Sorry about my question, I start to use the mixed models approach
> recently. My structure of data was:
>
> 'data.frame':	288 obs. of  13 variables:
>  $ Transecto        : int  2 2 2 2 2 2 3 3 3 3 ...
>  $ Ponto            : int  1 2 3 4 5 6 1 2 3 4 ...
>  $ Distancia        : int  160 120 80 40 20 0 160 120 80 40 ...
>  $ tipo_trat        : Factor w/ 4 levels "","controle",..: 3 3 3 3 3 3 4 4 4
> 4 ...
>  $ umid_inici       : num  81.3 84.1 81.3 83.9 81.9 ...
>  $ umid_final       : num  63.7 68 66.2 66.8 66.4 ...
>  $ temp_inici       : num  19.1 19.5 19.5 19.1 19.1 ...
>  $ temp_final       : num  29.1 27.8 27.6 28 28.6 ...
>  $ abertu_dossel    : num  35.6 20.8 28.9 30.6 27.1 ...
>  $ delta.umidade    : num  -17.6 -16.1 -15.2 -17.1 -15.5 ...
>  $ delta.temperatura: num  9.95 8.3 8.1 8.91 9.5 ...
>  $ remocao          : num  0.02 0 0.1 0 0.08 0 1 0.04 0.08 0.42 ...
>  $ riqueza          : int  3 9 3 3 4 5 4 3 2 5 ...
>
>
> And the summary of model below. In my case is a adjustment problem or in
> r.squaredGLMM() function?
>
>> summary(mT)
> Generalized linear mixed model fit by maximum likelihood (Laplace
> Approximation) [
> glmerMod]
>  Family: poisson  ( log )
> Formula: riqueza ~ tipo_trat + temp_final + temp_inici + umid_inici +
>     umid_final + (1 | Ponto)
>    Data: d1
> Control:
> glmerControl(check.conv.singular = "warning", optCtrl = list(maxfun =
> 1e+05))
>
>      AIC      BIC   logLik deviance df.resid
>    326.1    344.3   -155.0    310.1       64
>
> Scaled residuals:
>     Min      1Q  Median      3Q     Max
> -1.8416 -0.7947 -0.2221  0.7253  2.4622
>
> Random effects:
>  Groups Name        Variance  Std.Dev.
>  Ponto  (Intercept) 5.293e-17 7.275e-09
> Number of obs: 72, groups:  Ponto, 6
>
> Fixed effects:
>                       Estimate Std. Error z value Pr(>|z|)
> (Intercept)           -5.18941    3.18615  -1.629   0.1034
> tipo_trattrat_euc     -0.51209    0.29360  -1.744   0.0811 .
> tipo_trattrat_mat_euc -0.43877    0.25986  -1.688   0.0913 .
> temp_final             0.06914    0.04144   1.669   0.0952 .
> temp_inici             0.07176    0.05479   1.310   0.1903
> umid_inici             0.03270    0.02543   1.286   0.1985
> umid_final             0.01774    0.01660   1.069   0.2850
> ---
> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
>
> Correlation of Fixed Effects:
>             (Intr) tp_tr_ tp_t__ tmp_fn tmp_nc umd_nc
> tp_trttrt_c  0.457
> tp_trttrt__  0.525  0.358
> temp_final  -0.546 -0.393 -0.143
> temp_inici  -0.750 -0.557 -0.696  0.037
> umid_inici  -0.755  0.028 -0.522 -0.020  0.667
> umid_final  -0.287 -0.661  0.236  0.651  0.023 -0.352
> convergence code: 0
> Model failed to converge with max|grad| = 0.00894145 (tol = 0.001, component
> 1)
> singular fit
> Model is nearly unidentifiable: very large eigenvalue
>  - Rescale variables?
> Model is nearly unidentifiable: large eigenvalue ratio
>  - Rescale variables?
>
> --
> ======================================================================
> Alexandre dos Santos
> Proteção Florestal
> IFMT - Instituto Federal de Educação, Ciência e Tecnologia de Mato Grosso
> Campus Cáceres
> Caixa Postal 244
> Avenida dos Ramires, s/n
> Bairro: Distrito Industrial
> Cáceres - MT                      CEP: 78.200-000
> Fone: (+55) 65 99686-6970 (VIVO) (+55) 65 3221-2674 (FIXO)
> e-mails:alexandresantosbr at yahoo.com.br
>         alexandre.santos at cas.ifmt.edu.br
> Lattes: http://lattes.cnpq.br/1360403201088680
> OrcID: orcid.org/0000-0001-8232-6722
> Researchgate: www.researchgate.net/profile/Alexandre_Santos10
> LinkedIn: br.linkedin.com/in/alexandre-dos-santos-87961635
> Mendeley:www.mendeley.com/profiles/alexandre-dos-santos6/
> ======================================================================
>
> Em 06/02/2018 06:15, Thierry Onkelinx escreveu:
>
> Dear Alexandre,
>
> First of all you need to get a stable model. Otherwise any number you
> get from it is meaningless. Can you provide more detail on your model.
> E.g. summary(mT), str(d1), ...
>
> Best regards,
>
> ir. Thierry Onkelinx
> Statisticus / Statistician
>
> Vlaamse Overheid / Government of Flanders
> INSTITUUT VOOR NATUUR- EN BOSONDERZOEK / RESEARCH INSTITUTE FOR NATURE
> AND FOREST
> Team Biometrie & Kwaliteitszorg / Team Biometrics & Quality Assurance
> thierry.onkelinx at inbo.be
> Havenlaan 88 bus 73, 1000 Brussel
> www.inbo.be
>
> ///////////////////////////////////////////////////////////////////////////////////////////
> To call in the statistician after the experiment is done may be no
> more than asking him to perform a post-mortem examination: he may be
> able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher
> The plural of anecdote is not data. ~ Roger Brinner
> The combination of some data and an aching desire for an answer does
> not ensure that a reasonable answer can be extracted from a given body
> of data. ~ John Tukey
> ///////////////////////////////////////////////////////////////////////////////////////////
>
>
>
>
> 2018-02-05 20:15 GMT+01:00 ASANTOS via R-sig-mixed-models
> <r-sig-mixed-models at r-project.org>:
>
> Dear Mix Models Members,
>
>         I try to extract R^2 for linear mixed effects models with
> glmer() function with poisson distribution using r.squaredGLMM() in
> MuMIn package, but doesn't work. My output always show:
>
> #Model ajusted > mT <-glmer(riqueza ~tipo_trat+(1|Ponto),data=d1, +
> family=poisson, control = glmerControl(check.conv.singular =
> "warning",optCtrl = list(maxfun=100000))) Warning messages: 1: In
> checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, :Model
> failed to converge with max|grad| = 0.00894145 (tol = 0.001, component
> 1) 2: In checkConv(attr(opt, "derivs"), opt$par, ctrl =
> control$checkConv, :singular fit 3: In checkConv(attr(opt, "derivs"),
> opt$par, ctrl = control$checkConv, :Model is nearly unidentifiable: very
> large eigenvalue - Rescale variables?;Model is nearly unidentifiable:
> large eigenvalue ratio - Rescale variables? #R^2 conditional and
> marginal > r.squaredGLMM(mT) Error in glmer(formula = riqueza ~
> tipo_trat + temp_final + temp_inici + : fitting model with the
> observation-level random effect term failed. Add the term manually In
> addition: Warning message: In value[[3L]](cond) :(p <- ncol(X)) ==
> ncol(Y) is not TRUE
>
>       I change almost all parameters indicating by web posts like
> glmerControl, maxfun, etc. There are other approaches to calculate the
> conditional and marginal R^2 for my model with lme4 package?
>
> Thanks in advance,
>
> Alexandre
>
> --
> ======================================================================
> Alexandre dos Santos
> Proteção Florestal
> IFMT - Instituto Federal de Educação, Ciência e Tecnologia de Mato Grosso
> Campus Cáceres
> Caixa Postal 244
> Avenida dos Ramires, s/n
> Bairro: Distrito Industrial
> Cáceres - MT                      CEP: 78.200-000
> Fone: (+55) 65 99686-6970 (VIVO) (+55) 65 3221-2674 (FIXO)
>
>          alexandre.santos at cas.ifmt.edu.br
> Lattes:http://lattes.cnpq.br/1360403201088680
> OrcID: orcid.org/0000-0001-8232-6722
> Researchgate:www.researchgate.net/profile/Alexandre_Santos10
> LinkedIn: br.linkedin.com/in/alexandre-dos-santos-87961635
> Mendeley:www.mendeley.com/profiles/alexandre-dos-santos6/
> ======================================================================
>
>
>         [[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