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

Thierry Onkelinx thierry@onkelinx @ending from inbo@be
Mon Nov 19 09:54:12 CET 2018


Dear David,

I think you can solve this by creating a dummy variable which has zero's in
case you are not interested in the random slope.

Please note that sending HTML has ruined the code formating, making your
code much harder to read.

Best regards,

ir. Thierry Onkelinx
Statisticus / Statistician

Vlaamse Overheid / Government of Flanders
INSTITUUT VOOR NATUUR- EN BOSONDERZOEK / RESEARCH INSTITUTE FOR NATURE AND
FOREST
Team Biometrie & Kwaliteitszorg / Team Biometrics & Quality Assurance
thierry.onkelinx using inbo.be
Havenlaan 88 bus 73, 1000 Brussel
www.inbo.be

///////////////////////////////////////////////////////////////////////////////////////////
To call in the statistician after the experiment is done may be no more
than asking him to perform a post-mortem examination: he may be able to say
what the experiment died of. ~ Sir Ronald Aylmer Fisher
The plural of anecdote is not data. ~ Roger Brinner
The combination of some data and an aching desire for an answer does not
ensure that a reasonable answer can be extracted from a given body of data.
~ John Tukey
///////////////////////////////////////////////////////////////////////////////////////////

<https://www.inbo.be>


Op do 8 nov. 2018 om 16:55 schreef David Sidhu <dsidhu using ucalgary.ca>:

> 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]]
>
> _______________________________________________
> R-sig-mixed-models using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>

	[[alternative HTML version deleted]]



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