# Correct formula for MixedModels, lme4

**URL:** <https://discourse.julialang.org/t/correct-formula-for-mixedmodels-lme4/37343>\
**Category:** Statistics\
**Tags:** question\
**Created:** [April 10, 2020, 1:59pm UTC](https://discourse.julialang.org/t/correct-formula-for-mixedmodels-lme4/37343 "2020-04-10T13:59:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Enrico\_Schulz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/enrico_schulz/32/12578_2.png) [@Enrico\_Schulz](https://discourse.julialang.org/u/Enrico_Schulz)\
**Post date:** [April 10, 2020, 1:59pm UTC](https://discourse.julialang.org/t/correct-formula-for-mixedmodels-lme4/37343/1 "2020-04-10T13:59:21Z")

</div>

Dear statistics experts,  
I am using MixedModels.jl in Julia with this formula:

f2 = @formula(fmri~AMP+SLP+aSLP+(0+AMP|session)+(0+SLP|session)+(0+aSLP|session));

The toolbox in Julia is from Douglas Bates und the formula specification should be similar to lme4. My experiment includes 20 subjects with 4 recordings each. It  
assumes a common slope across all subjects and sessions.  
I think the model needs to be changed. I think it would be better to model a common slope for each subject (across the 4 recordings) but keep the session-specific intercept. How would the new model need to be specified?  
Thank you, Enrico
