Meaning of Corr of random-effects with a cross-level interaction
Dear all After some further thought and simulations I found that the objective, to uncover different correlations between slopes and intercepts in different groups, can be achieved simply by fitting the cross-level interaction as a random slope. In lme4 this fits separate random slopes for each group along with the correlations. Simulations seem to confirm that it works, at least for the limited simulation scenarios that I tried: https://stats.stackexchange.com/questions/489059/obtaining-correlation-between-random-effects-separately-for-2-groups/489181#489181 Best wishes Robert Long
On Fri, Sep 25, 2020 at 9:56 AM Robert Long <longrob604 at gmail.com> wrote:
Hi Thierry and list This was actually cross-posted at CrossValidated yesterday: https://stats.stackexchange.com/questions/488984/corr-of-random-effects-when-a-cross-level-interaction-in-lme4 I have the impression that Simon is experimenting with a toy dataset, rather than analysing their own study, which is a great way to learn, in my opinion. As you can see from my answer and the comments to it, the real question (actually, two questions) is this: Suppose we have two groups of schools, with a single explanatory variable at the student level. Suppose further that the correlation between the random slopes for that variable and the random intercepts in the two groups is very different. The first question is what the overall correlation represents ? I thought that it would probably be some kind of average of the two. I did some simulations that indicate that this seems to be the case. The followup question (see the last comment to my answer) asks how to uncover the correlations in the two groups ? From my simulations so far the only way I can see of doing this is by splitting the data by group and fitting two models. Best regards Robert Long On Fri, Sep 25, 2020 at 9:04 AM Thierry Onkelinx via R-sig-mixed-models < r-sig-mixed-models at r-project.org> wrote:
Dear Simon, A perfect correlation between random effect parameters indicates a problem. Note the failed convergence warning. Standardising ses makes things even worse: it yields a singular fit error. Removing the random slope of ses or the sector interaction solves the problem. i.e. the model runs and yields sensible output. Looking at the data, it seems like both math and ses have bounds. Ses even seems to have some data above its upper bound. The model assumes no bounds in the response variable. Maybe this is the cause of the problem. ggplot(hsb, aes(x = ses, y = math, colour = factor(sector))) + geom_point() Best regards, Thierry 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 at 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 24 sep. 2020 om 18:39 schreef Simon Harmel <sim.harmel at gmail.com>:
Dear All, I had a quick question. I have a cross-level interaction in my model
below
(ses*sector). My cluster-level predictor "sector" is a binary variable
(0=Public, 1=Private). My level-1 predictor is numeric.
QUESTION: The `Corr = 1` is indicating the correlation between
intercepts and slopes across BOTH public & private sectors (like their
average) OR something else?
hsb <- read.csv('
https://raw.githubusercontent.com/rnorouzian/e/master/hsb.csv')
summary(lmer(math ~ ses*sector + (ses|sch.id), data = hsb))
Random effects:
Groups Name Variance Std.Dev. Corr
sch.id (Intercept) 3.82107 1.9548
ses 0.07587 0.2754 1.00
Residual 36.78760 6.0653
[[alternative HTML version deleted]]
_______________________________________________ R-sig-mixed-models at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
[[alternative HTML version deleted]]
_______________________________________________ R-sig-mixed-models at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models