StatsModels: get levels and model matrix for each level of categorical term

this can be helfull:


function lcontrast(mm::ModelMatrix, i::Int)
    n = mm.assign[end]
    if i > n || n < 1 error("Factor number out of range 1-$(n)") end
    inds = findall(x -> x==i, lmm.mm.assign)
    mx = zeros(length(inds), size(lmm.mm.m, 2))
    for i = 1:length(inds)
        mx[i, inds[i]] = 1
    end
    mx
end