# [R-sig-ME] [R] understanding I() in lmer formula

Don Cohen don-r-help at isis.cs3-inc.com
Thu Jun 15 21:31:34 CEST 2017

```Emmanuel Curis writes:
>  So when I run lmer I should be able to recover these 5 values, right?
>  How do I do that?
>
> All of them are in summary( lmer( formula, data = ... ) )
> summary(m3fr)
> For uA and uB estimtions, you can have them with fixef()
> For f, g and h, you can have them with VarCorr()

Ah, now that I compare fixef and VarCorr with summary
I see which ones you mean.

> The opposite of the log likelihood, -log L, of the data, more
> precisely assuming independant data points
>
> L = \prod_{i=1}^n \prod_{,j=1}^{n_i} F'(Yij=y_ij|Ai=ai,Bi=bi) G'(Ai=ai, Bi=Bi)
>
> where F' is the density of a Gaussian of mean ai + bi * days_{i,j} and
> variance sigma (the variance of epsilon, the residual) and G' the
> joint density of a binormal Gaussian vector of expectation (uA, uB)
> and of covariance matrix Sigma = ( (f, g ), ( g, h ) ) and you
> minimize -log L. i the subject index, j the measure index within the subject.

I'm having a little trouble with your character set (notice I've been
replacing your mu's with "u") and a little more with the \math
notation, but I think what I'm seeing above is that the likelihood
measure is computed purely from measures for the data points and the
measure for a single data point is the product of a likelihood of the
a,b pair for the group, which is G', and the likelihood of the point
given the group, which is F'.

Now this already surprises me in the sense that the cost of the
group seems to be paid above once for every data point in the group
instead of only one time for the group.
It seems to me that if I were trying to specify the groups and
data points I'd only have to specify each group once and within
that each data point for the group once.
But maybe this is just a matter of missing parens?
That would be
product over all groups of
prob for (a,b) for this group
x
product over all points in the group of
prob of point given group (related to square of residual)

A few other details:
The residual is still only one number for each point, right, so sigma,
its variance, is only one number, right?
And this is estimated by just computing the variance of the residues?
I'm guessing that's the same thing as finding the value that minimizes
the product of the F' values.
Is there a function to compute G' ?
(Is this it?
library(mvtnorm)
dmvnorm(c(5.280231, 9.719769), c(5,10),matrix(c(1,-.9,-.9, 1),nrow=2,ncol=2))
)

> Just write it down using the hints above... Or use the formulas in
> Douglas Bates' book (or other books). They _are_ the objective
> function. By e-mail, that would be almost impossible to write them in
> a readable way.

Which book is this?  URL ?
lme4: Mixed-effects modeling with R, June 25, 2010 ?
http://lme4.r-forge.r-project.org/lMMwR/lrgprt.pdf ?
I'll look further at that.

Also, bbolker writes:
vignette("lmer",package="lme4") gives all of the technical details
It gives me:
Warning message:

Is this the same as (or similar to)
https://cran.r-project.org/web/packages/lme4/vignettes/Theory.pdf
Or
https://cran.r-project.org/web/packages/lme4/vignettes/lmer.pdf
which seems to be the same as the one I had trouble with before.
But maybe I can make more progress in these now that I have some
ability to ask questions.

>  So far I don't think I've learned anything new, but I may be getting
>  close to describing to you what I'm missing.

This is progress.  It's similar to what I was expecting, but not
what I was able to explain from my simple examples.  It's possible
that the problem was in my examples, but that remains to be seen.

```