# Model specification for linear mixed model

Last week I wrote about my implementation of an algorithm that fits a linear mixed model in Ruby using the gem MixedModels, that I am working on right now. See, first rudimentary LMM fit.

PhD student with (severely sleep deprived) focus on statistics, machine learning, and programming

Last week I wrote about my implementation of an algorithm that fits a linear mixed model in Ruby using the gem MixedModels, that I am working on right now. See, first rudimentary LMM fit.

This is the final part of my analysis of the function `lmer`

, which is used to fit linear mixed models in the R package `lme4`

. In two previous blog posts, we have seen the general layout of the function `lmer`

, the dealings with the R model formula, and the setting up of the objective function for the optimization (see part 1 and part 2).

Last time I started to analyze the function `lmer`

that is used to fit linear mixed models in the R package `lme4`

. I have delineated the general steps taken by `lmer`

, and looked at the employed formula module in more detail. The formula module evaluates the provided R model formula to model matrices, vectors and parameters. The next step is to use these to define the objective function that needs to be minimized, which is the profiled deviance or the profiled REML criterion in this case. The objective function is returned by the function `mkLmerDevfun`

which is dissected in what follows.

This blog posts marks the start of my Google Summer of Code project with the Ruby Science Foundation, where I will develop mixed linear models software for Ruby. As a preparation for my GSoC project, I will dedicate a couple of blog posts to a meticulous analysis of `lme4`

code (so that I can steal all the ideas from it!).