# [R-sig-ME] Lmer binomial distribution x HLM Bernoulli distribution

Doran, Harold HDoran at air.org
Tue Feb 1 20:48:09 CET 2011

```Luana

It appears to me that your results are indeed the same. For instance, you have the variance of the schid as .177 and .18 from the different programs. If you are expecting results to match exactly to the same decimal place, you are worrying about a red-herring.

Keep in mind a few things. First, HLM probably uses a different stopping criterion than lmer. Second, HLM uses a 6th order Taylor-series expansion for GLMMs and lmer uses a laplace approximation. So, the estimating algorithm is slightly different.

> -----Original Message-----
> From: r-sig-mixed-models-bounces at r-project.org [mailto:r-sig-mixed-models-
> bounces at r-project.org] On Behalf Of Luana Marotta
> Sent: Tuesday, February 01, 2011 2:24 PM
> To: R-SIG-Mixed-Models; Douglas Bates
> Subject: [R-sig-ME] Lmer binomial distribution x HLM Bernoulli distribution
>
> Dear R-users,
>
> I'm running a lmer model using the lme4 package. My dependent variable is
> dichotomous and I'm using the "binomial" family. The results
> are slightly different from the HLM results based on a Bernoulli
> distribution. Please, see the results below:
>
> Level 1 info:  Size: 129006      Mean: 0.7082 (dichotomous variable 0/1)
>
> Level2 info:   Size:  384
>
>
>
> *HLM model:*
>
> Distribution at Level-1: Bernoulli
>
> Level-1 Model
>
>                 Prob(Y=1|B) = P
>
>                 log[P/(1-P)] = B0
>
>
>
> Level-2 Model
>
>                 B0 = G00 + U0
>
>
> *HLM results:*
>
> Random effects:
>
> Groups Name          Variance Std.Dev.
>
> schid  (Intercept)     0.17727  0.42104
>
>
>
> Fixed effects:
>
>                           Estimate Std. Error    z value Pr(>|z|)
>
> (Intercept)          1.001561     0.023039  43.473   0.000
>
>
>
>
>
> *R model:*
>
> lmer(measurebi_general ~ 1 + (1 | schid), data=data_valid_general,
> family=binomial)
>
>
>
> *R results:*
>
>    AIC    BIC logLik deviance
>
>  153195 153214 -76595   153191
>
>
>
> Random effects:
>
> Groups Name          Variance Std.Dev.
>
> schid  (Intercept)     0.18007  0.42434
>
>
>
> Fixed effects:
>
>                           Estimate Std. Error z value Pr(>|z|)
>
> (Intercept)          1.0071     0.0232   43.41   <2e-16 ***
>
>
>
> Is there anyway that I can adapt my R model so that the R results are the
> same as the HLM results?
>
>
> I'm using the lme4 for linear data and the R results are exactly the same as
> the ones produced by HLM. It is very important for me to have both results
> the same because I'll be discussing the results with researchers who use
> exclusively the HLM software.
>
>
> Thank you,
>
>
> Luana Marotta
>
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models

```