# Help with error in MixedModels.jl

**URL:** <https://discourse.julialang.org/t/help-with-error-in-mixedmodels-jl/10374>\
**Category:** New to Julia\
**Created:** [April 16, 2018, 9:20pm UTC](https://discourse.julialang.org/t/help-with-error-in-mixedmodels-jl/10374 "2018-04-16T21:20:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![yanivab](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yanivab/32/9164_2.png) [@yanivab](https://discourse.julialang.org/u/yanivab)\
**Post date:** [April 16, 2018, 9:20pm UTC](https://discourse.julialang.org/t/help-with-error-in-mixedmodels-jl/10374/1 "2018-04-16T21:20:15Z")

</div>

Hello,

I am trying out MixedModels most basic functioning. I am loading data into Julia using the R package JuliaCall, in order to streamline the needed functionality into my existent R analysis, as described [here](https://rpubs.com/dmbates/377897).

While Douglas Bates’ demo with the kb07 data frame works without a problem, when trying to fit the model  
rtlog ~ contrastc_stimType + (1 + contrastc_stimType | subj) + (1 + contrastc\*stimType | stim)

to my data frame (where contrastc and rtlog are numeric, the rest factors),

I get the following error:

MethodError: no method matching getindex(::DataFrames.DataFrame, ::Expr)  
Stacktrace:  
[1] collect\_to!(::Array{AbstractArray{T,1} where T,1}, ::Base.Generator{Array{Any,1},StatsModels.##23#25{DataFrames.DataFrame}}, ::Int64, ::Int64) at ./array.jl:508  
[2] collect\_to!(::Array{Array{Float64,1},1}, ::Base.Generator{Array{Any,1},StatsModels.##23#25{DataFrames.DataFrame}}, ::Int64, ::Int64) at ./array.jl:518  
[3] \_collect(::Array{Any,1}, ::Base.Generator{Array{Any,1},StatsModels.##23#25{DataFrames.DataFrame}}, ::Base.EltypeUnknown, ::Base.HasShape) at ./array.jl:489  
[4] map(::Function, ::Array{Any,1}) at ./abstractarray.jl:1868  
[5] #ModelFrame#22(::Dict{Any,Any}, ::Type{T} where T, ::StatsModels.Terms, ::DataFrames.DataFrame) at /Users/yanivabir/.julia/v0.6/StatsModels/src/modelframe.jl:144  
[6] (::Core.#kw#Type)(::Array{Any,1}, ::Type{StatsModels.ModelFrame}, ::StatsModels.Terms, ::DataFrames.DataFrame) at ./:0  
[7] #ModelFrame#27(::Array{Any,1},

Any ideas? I am obviously new to Julia, and the lack of any noticeable difference between the kb07 data frame and mine is frustrating…

thanks!

---

<div class="post-metadata">

**Author:** ![Non-Contradiction](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/non-contradiction/32/2208_2.png) [@Non-Contradiction](https://discourse.julialang.org/u/Non-Contradiction)\
**Post date:** [April 16, 2018, 9:57pm UTC](https://discourse.julialang.org/t/help-with-error-in-mixedmodels-jl/10374/2 "2018-04-16T21:57:06Z")

</div>

Hi, I’m the maintainer of JuliaCall.  
Could you provide the exact code you are running? It is hard to tell where the problem is with just the formula and error messages.

---

<div class="post-metadata">

**Author:** ![yanivab](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yanivab/32/9164_2.png) [@yanivab](https://discourse.julialang.org/u/yanivab)\
**Post date:** [April 17, 2018, 8:23am UTC](https://discourse.julialang.org/t/help-with-error-in-mixedmodels-jl/10374/3 "2018-04-17T08:23:26Z")

</div>

Hi,

I found the issue just now - it’s not to do with JuliaCall, but with MixedModels.jl, which errors when random interaction terms are present in a formula, see this issue: [https://github.com/dmbates/MixedModels.jl/issues/100](https://github.com/dmbates/MixedModels.jl/issues/100).

Thanks for the response!
