Elena Wolf
2014-Jan-29 09:29 UTC
[R] how to exclude level 1 residuals from multilevel model with lme4
Dear community, I have the following problem: I have a multilevel model with two level 1 nominal predictors. My level one predictors are experimental condition nested in persons. I used the R-package lme4 my data file looks like that: (DV = dependent variable, IV = independent variable) I want to do the following random slope model: library(lme4) rs.model <- lmer(DV~ 1 + IV1 * IV2 + (1 + IV1 * IV2 | id), data=dat) summary(rs.model) I want to integrate the interaction term as a varying slope because I assume that the interaction will look different for different individuals. (I know I can do a repeated measure ANOVA, but this won't help me as I want to explain this different interaction patterns with a between subjects Level 2 Variable (IV3) which is metric). The final model should be: rs.model.final <- lmer(DV~ 1 + IV1 * IV2 * IV3 (1 + IV1 * IV2 | id), data=dat) summary(rs.model.final) The problem is, that actually my model is not allowed to have Level 1 residuals because every person has just one datapoint for the interaction of the experimental conditions (IV1*IV2). But if I use the usual lmer-function the package does include level 1 residuals although it shouldn't ... also en error message appears: In checkZrank(reTrms$Zt, n = n, control, nonSmall = 1e+06) : number of observations <= rank(Z); variance-covariance matrix will be unidentifiable Consequently I am not allowed to interpret my output although lmer calculates one. My question is: Is there a possibility to exclude the level 1 residuals from the model? Or does someone know another package so I can calculate my model? Hope someone can help me... Regards Elena