Can a random intercept act as moderator in a mixed-effects model ? (Lmer - R) This post is related to my previous ones, but now I'm looking at each year separately (i.e, this is not a repeated measures design). My data set looks like this:
SUBJECT    PROFICIENCY (in Eng) SCORE LANGUAGE

PETER      100                   154    Spanish 
PETER      100                   132    English
MARY       95                    191    Spanish
MARY       95                    139    English

So each SUBJECT was tested twice: one test in English and one test in Spanish. Therefore, each SUBJECT has 2 exam scores. I want to see the impact of Language on the test scores. However, I already know that Proficiency in English is highly correlated to the test score in English:

What I'm wondering is if I can fit a model in which I could use proficiency as a "moderator" (something like a partial correlation). My idea was to fit a model with a random intercept for Proficiency. The thing is, I only have one Proficiency score per student (I don't have a Proficiency score for Spanish). Hence, I have two entries for Language and one for Proficiency (in Eng).
Would this make sense:
mod1 <- lmer(ExamScore ~ LANGUAGE + (1 | SUBJECT) + (1|PROFICIENCY IN ENG), data = data)

I have seen similar questions elsewhere with a categorical moderator (here and others
Thanks in advance, any thoughts would be much appreciated :)
 A: Proficiency is a continuous variable, ranging from 0 to 100. It's not clear how you propose to include it as a random effect. Unless you bin it into levels of proficiency but why would you want to do that? See the discussion on Why should binning be avoided at all costs?
Instead treat proficiency as a covariate, that is, include it in the mean structure of the model: ExamScore ~ Language + Proficiency. Optionally, you can "spline" it to allow for a smooth, flexible and nonlinear relationship between proficiency and test scores. However, before including Proficiency in the model at all, consider carefully what it measures: English proficiency (as a second language) before the test? after the test? throughout the school year? It might not make sense to have this variable in the model at all.
How do I enter a continuous variable as a random effect in a linear mixed effects model? explains that a random effect is conceptualized as a population of groups (students) from which we have drawn a random sample (students who have taken English and Spanish language tests).
