The correspondence between the R and Julia models here does not seem accurate. There are also problems with various numerical algorithms. But my attempt to recreate the same model using MixedModels as follows:
using RDatasets using MixedModels mtcars = dataset("datasets","mtcars") mtcars[:AM] = PooledDataArray(mtcars[:AM]) mtcars[:Gear] = PooledDataArray(mtcars[:Gear]) mtcars[:GearAM] = PooledDataArray(collect(zip(mtcars[:Gear],mtcars[:AM]))) m = fit!(lmm(MPG ~ 1 + Gear + AM + Cyl + HP + (1|GearAM),mtcars))
Manually creating a mixed effect column - klunky - there may be a better way. Note the differences in naming coefficients between R and Julia. In both cases, there are 6 fixed effect coefficients.
The solution in Julia seems different (on my machine), but achieves a better logarithmic probability. The random effect is expected to be weak, as its variables are already present in fixed effects (it only takes into account the relationship between Gear and AM), and there are only 32 data points.
Hope this helps, and if you come up with a better understanding, it would be nice to add it to another answer or comment.
source share