# LMM coefficient difference

**URL:** https://discourse.julialang.org/t/lmm-coefficient-difference/95626
**Category:** Statistics
**Tags:** question, statistics, mixed-models
**Created:** [March 6, 2023, 6:05pm UTC](https://discourse.julialang.org/t/lmm-coefficient-difference/95626 "2023-03-06T18:05:04Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![PharmCat](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pharmcat/32/6953_2.png) [@PharmCat](https://discourse.julialang.org/u/PharmCat)
#### Post date: [March 6, 2023, 6:05pm UTC](https://discourse.julialang.org/t/lmm-coefficient-difference/95626/1 "2023-03-06T18:05:04Z")

</div>

Hello!  
I try to use MixedModels and GLM for binary data outcome analysis. So I have model:

`@formula(resp ~ pred1 + pred2)`

where `pred1` and `pred2` are continuous predictors. I fit model with `Bernoulli()` distribution and `LogitLink()` link function. After that I have `coef` vector with 3 coefficients.

So, I want to get difference: `pred1 - pred2` and interpret this like `exp(OR*)`. For that I make contrast vector `l = [0, 1, -1]`, than get difference `diff = l'*coef(glm_model)` and SD: `diff_sd = sqrt(dot(l, vcov(glm_model), l))`.

Does that calculations meaningful?

\*OR = p1 \* (1 - p2)/ p2 / (1 - p2)
