[R-sig-ME] multilevel linear models

marKo mtoncic at ffri.hr
Fri Oct 25 12:12:02 CEST 2013


On 23.10.2013 08:35, srecko joksimovic wrote:
> Hi,
> just recently I started my research on MLM, but now I'm little bit
> confused... I tried to build a model, but now I'm not quite sure what's the
> right thing I'm trying to do. The point is that I have a dataset with
> counts and time of users activity. For example, it looks something like
> this:
> userID, group, department, organizationalUnit, activityCount, activityTime,
> totalPoints
> 112,     g1,      d1,              o1                        232
>      45,4              45
> 122,     g3,      d2,              o1                        323
>      25,6              25
> 892,     g1,      d1,              o1                        98
>      56,3              99
> 313,     g2,      d1,              o2                        332
>      41,5              67
> 763,     g3,      d2,              o2                        555
>      89.7              23
>
> maybe the example itself it's not that important at this point, but I could
> provide more data if that is needed. However, the original idea was to use
> activitycount, totalpoints, organizationalUnit and department as a fixed
> variables, as well as interactions between organizationalUnits vs. count
> and time and, department vs. count and time. Random variables are usedId
> and group\department. The problem occurs when I add department as a fixed
> and/or random part, because of the following error:
> Error in lme4::lFormula(formula = totalPoints~ activityCount  +
> activityTime  + ...: rank of X = 38 < ncol(X) = 39.
>
> I decided to remove group\department as a random effect, but that might not
> be good, because I need group nested under department. I also tried to add
> another random variable group\organizationalUnit | userID, which (I hope)
> means that user varies across groups which are nested under the
> organizational units. And I'm not sure about that part. In lmer (lmerTest)
> documentation, I found several examples, which translated to this one could
> be written like this:
> group:organizationalUnit | userID
> group\organizationalUnit | userID
> group+organizationalUnit | userID
>
> could someone please explain how those models are different, and what they
> mean? I tried to run all of them but I run out of memory. I know that 8GB
> of RAM is not too much, but it was enough for most of my tests. Should I
> look for more RAM or should I correct my model? :)
>
> thanks,
> Srecko
>
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
At first it seems odd to me to estimate the same effect as fixed and 
random. Maybe I'm wrong but I think it doesn't make sense (I guess that 
it might be sound in some circumstances but I cannot think of one). 
Check if your categorical variables are defined as factors. As concerns 
the random parameter distinction in definition it should result as 
generally in linear model definition.
A:B → only the interaction term
A*B → main effects and interaction
A+B → only main effects
In the random part you estimate the intercept if you specify as you have 
(if you do not want to, you should state it explicitly by (0+A+B|ID).
I think that RAM is not the problem. I have fitted models to large data 
setts with less RAM without problems.
Hope it helps.

Marko



More information about the R-sig-mixed-models mailing list