# Contrasts coding in MixedModels

**URL:** https://discourse.julialang.org/t/contrasts-coding-in-mixedmodels/62131
**Category:** General Usage
**Tags:** statsmodels
**Created:** [May 31, 2021, 12:30pm UTC](https://discourse.julialang.org/t/contrasts-coding-in-mixedmodels/62131 "2021-05-31T12:30:51Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Hilary](https://avatars.discourse-cdn.com/v4/letter/h/d2c977/32.png) [@Hilary](https://discourse.julialang.org/u/Hilary)
#### Post date: [May 31, 2021, 12:30pm UTC](https://discourse.julialang.org/t/contrasts-coding-in-mixedmodels/62131/1 "2021-05-31T12:30:51Z")

</div>

Hi guys,  
I have implemented my `SAS Mixed Model` on `Julia`.  
However, currently there are differences in **estimates** between `SAS` and `Julia` for fixed and random effects.  
I tried changing the contrasts - maybe this can help to achieve more similar estimates to `SAS` .  
I do it in this way:

```julia
const HC = HelmertCoding()
const contrasts = Dict(:var1 => HC, :var2 => HC, :var3=> HC, :subject=> Grouping())
model = fit(MixedModel, fm, data, contrasts=contrasts, REML=true)

```

Thus, I got three models (with different types of contrasts):

```julia
DummyCoding
EffectsCoding
HelmertCoding

```

but my estimates are completely identical:

 ![image](https://global.discourse-cdn.com/julialang/original/3X/3/8/380eb82ceb2755f4ceff681b92d08c45c6c86d9e.png)

What am I doing wrong?  
Are there any ways to get FE and RE estimates in `Julia` fully identical to `SAS`?

I would be grateful for any help!

---

<div class="post-metadata">

### Author: ![Christopher\_Fisher](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/christopher_fisher/32/26132_2.png) [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)
#### Post date: [May 31, 2021, 5:53pm UTC](https://discourse.julialang.org/t/contrasts-coding-in-mixedmodels/62131/2 "2021-05-31T17:53:38Z")

</div>

Welcome to the community. Would you be able to provide a minimum working example with simulated data that replicates the behavior? That would help us diagnose the problem.
