[R-sig-ME] Another predict/cloglog peculiarity --- lme4 this time.

Thierry Onkelinx th|erry@onke||nx @end|ng |rom |nbo@be
Fri Apr 3 09:00:13 CEST 2020


Dear Rolf,

This is due to the precision of floating point numbers. Let's have a look
at what happens when we get the extreme negative difference.

> i <- which.min(g(predResp) - predLink)
> c(predResp[i], 1 - exp(-exp(predLink[i])))
76 76
 1  1
> c(1 - predResp[i], exp(-exp(predLink[i])))
          76           76
2.220446e-16 0.000000e+00
> c(-log(1 - predResp[i]), exp(predLink[i]))
        76         76
  36.04365 3602.72298
> c(log(-log(1 - predResp[i])), predLink[i])
      76       76
3.584731 8.189445

Best regards,

Thierry

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 using 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
///////////////////////////////////////////////////////////////////////////////////////////

<https://www.inbo.be>


Op vr 3 apr. 2020 om 02:36 schreef Rolf Turner <r.turner using auckland.ac.nz>:

>
> I'm a bit hesitant to ask this, since the last time that I asked about a
> peculiar result from predict and the "cloglog" link, it turned out that
> the problem was due to my having installed an "unorthodox" version of
> the glmmTMB package.  So I had egg on my face.
>
> This time the package involved is lme4 and I'm pretty sure that I am
> using the "standard" version.  (See my session info below.) If I am just
> doing something stupid, I apologise for the noise.
>
> Now to the question:
>
> I'm pretty sure that
>
>     linkfun(predict(fit,type=response))
>
> should be equal to predict(fit,type="link")  and likewise
>
>     linkinv(predict(fit,type="link"))
>
> should be equal to predict(fit,type="response")) .
>
> With lme4, when the "logit" link is used, both of these equalities
> appear to hold.  When the "cloglog" link is used, the second equality
> holds, but in first instance I get a range of differences:
>
> > [1] -4.60471443  0.00281936
>
> I have attached a sourceable script "demo.txt" and the data set "X.txt"
> upon which it depends to demonstrate this phenomenon.
>
> I'd appreciate any enlightenment that anyone can provide about what's
> going on here.  If I'm just being stupid, please feel free to tell me
> so, as bluntly as you like.
>
> My session info:
>
> > R version 3.6.3 (2020-02-29)
> > Platform: x86_64-pc-linux-gnu (64-bit)
> > Running under: Ubuntu 18.04.4 LTS
> >
> > Matrix products: default
> > BLAS:   /usr/lib/x86_64-linux-gnu/atlas/libblas.so.3.10.3
> > LAPACK: /usr/lib/x86_64-linux-gnu/atlas/liblapack.so.3.10.3
> >
> > locale:
> >  [1] LC_CTYPE=en_GB.UTF-8       LC_NUMERIC=C
> >  [3] LC_TIME=en_NZ.UTF-8        LC_COLLATE=en_GB.UTF-8
> >  [5] LC_MONETARY=en_NZ.UTF-8    LC_MESSAGES=en_GB.UTF-8
> >  [7] LC_PAPER=en_NZ.UTF-8       LC_NAME=C
> >  [9] LC_ADDRESS=C               LC_TELEPHONE=C
> > [11] LC_MEASUREMENT=en_NZ.UTF-8 LC_IDENTIFICATION=C
> >
> > attached base packages:
> > [1] stats     graphics  grDevices utils     datasets  methods   base
> >
> > other attached packages:
> > [1] lme4_1.1-21   Matrix_1.2-17 brev_0.0-3
> >
> > loaded via a namespace (and not attached):
> >  [1] minqa_1.2.4     MASS_7.3-51.5   compiler_3.6.3  Rcpp_1.0.4
> >  [5] splines_3.6.3   nlme_3.1-144    grid_3.6.3      nloptr_1.2.2.1
> >  [9] boot_1.3-24     lattice_0.20-40
>
> Thanks.
>
> cheers,
>
> Rolf Turner
>
> --
> Honorary Research Fellow
> Department of Statistics
> University of Auckland
> Phone: +64-9-373-7599 ext. 88276
> _______________________________________________
> R-sig-mixed-models using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>

	[[alternative HTML version deleted]]



More information about the R-sig-mixed-models mailing list