am800
am800

Reputation: 11

Predict using julia lang MixedModels.jl

I am pretty new to the Julia language (using Version 0.6.0 (2017-06-19 13:05 UTC) Official http://julialang.org/ release x86_64-w64-mingw32 on a Windows 7 machine). I have an R background and found the implementations of mixed models to be slow for very big data sets (n>2,000,000, p > 100). Hence, I searched for alternatives and Julia seems to be lightning fast when it comes to estimation time.

The question I want to raise here is about the MixedModels.jl package of dmbates. Despit its incredible speed compared to, e.g., lme4, I was wondering if there is also some prediction function. Here is a mwe that calls the Dyestuff data from R`s lme4 package:

using MixedModels, RCall

R> library(“lme4”)
R> data(Dyestuff)

Dyestuff = rcopy(R"Dyestuff");
mm = fit!(lmm(@formula(Yield ~ 1 + (1 | Batch)), Dyestuff));

So how can I do predictions using something like:

predict(mm, newdata = Dyestuff)

Many thanks in advance.

Upvotes: 1

Views: 527

Answers (1)

Livius
Livius

Reputation: 3388

Please note that Julia has yet to reach v1.0 yet and there are often big, breaking API changes between releases. Likewise MixedModels.jl is in active development and must track the Julia API changes in its own API. The information here is (hopefully) correct at the time of writing.

Looking at the source code for MixedModels.jl at the current revision e566fcf, there is no predict() method, but there is fitted() method which inherits from / overrides StatsBase.fitted(). It should be easy enough to also write predict() method overriding StatsBase.predict() and submit it as a pull request. You might want to look at the simulate() method -- instead of generating new data based on existing data, you would use data passed as an argument.

Upvotes: 1

Related Questions