[R-sig-ME] Adding random subject or item slopes for a specific contrast

David Sidhu d@idhu @ending from uc@lg@ry@c@
Wed Nov 7 23:27:47 CET 2018


Hi There

I have been following the approach described in Bates et al. (2018) to simplify my random effects structure. I will use the data pasted below as an example (though the effects I describe aren’t present there, I use it only to have an example to refer to).

Now, if it seems that there is variance in the random subject slope comparing IV1 level 2 vs. IV1 level 1, but in no other contrast’s random subject slope, I would like to only include a random subject slope for that one specific contrast. Also assume that the method described by Bates et al. (2018) suggests that the random effects structure should only have one component.

Two questions: Is it sensible to only include this one slope? Is it possible in lme4 to only include this one slope?

Thanks!
Dave





Subj <- rep(1:10, each = 10) Item <- rep(1:10, times = 10) IV1 <- rep(1:5, times = 20) DV <- rnorm(100) library(data.table) data <- as.data.table(cbind(Subj, Item, IV1, DV)) data$Subj <- as.factor(data$Subj) data$Item <- as.factor(data$Item) data$IV1 <- as.factor(data$IV1) library(MASS) contrasts(data$IV1) <- contr.sdif(5) library(lme4) m <- lmer(DV ~ IV1 + (1 + IV1|Subj) + (1|Item), data = data)




---
David M. Sidhu, MSc
PhD Candidate
Department of Psychology
University of Calgary







	[[alternative HTML version deleted]]



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