How do I run a linear mixed effects model with both composite and non-composite variables? As the question states, I am looking to run a lmer model with two main effects and one moderator, with some random effects of participants or schools potentially added in. The idea is something like this:
lmer(y ~ (x1 + x2)*(z) + (1|random), data=data)
The idea is that z moderates x1 and x2 individually. As far as I know, this is how R runs it...it generates a summary with x1 slope, x2 slope, and then x1:z and x2:z slopes. This on its own is easy enough for me to understand and models what I want.
However, x1 and x2 are composite scores (the participants would only have one sum score) whereas z is a raw value that has as many entries as y (so lets say n of y is 1000, then n of z is also 1000). It does not make sense to make z a composite score, as its sum does not have a meaningful value. To make things more clear, the variables would be something akin to the following, with vowel count being a measure of how many vowels are in each word:
Word Writing Accuracy = (IQ + Visual Motor Skills) * Vowel Count + (1|Participant)

Is this a sensible way of modeling it in a mixed effects model? Or is there something I must adapt to make this model sensible?
 A: I'm going to try to make things a little more concrete so that it is easier to answer.  I'll focus on the variables that were provided for clarity.
Additional Assumption:  The IQ and Visual Motor Skills are measured once for each Participant, but the accuracy and vowel count are measured with each trial.  There can be multiple trials per participant.
Considerations:

*

*If accuracy is on a (0,1) scale, then you might want to consider linearizing the variable with a logistic transform or using a generalized linear mixed model.  glmer does not allow for the quasibinomial family or beta family in R.

*If my assumption is correct, then you are going to have to account for the fact that IQ and Visual Motor Skills are only measured once so that the trials are all correlated within person.  Repeated measures analysis is something you can research.  I drew some inspiration from here:

In other words, you should account for all sources of non-independence introduced by repeated sampling from the same subjects or stimuli. This approach is known as the maximal random effects approach or the design-driven approach to specifying random effects structure (Barr et al., 2013).
Following this, I suggest a different model than the simple random intercept from the question.  See the R code below.


*I didn't do any work on correctly specifying the degrees of freedom or correct statistical tests.  That would still need to be done.

require(lme4)

# Design
nparticipants <- 200
ntrials <- 1000

# simulate data
set.seed(19483093)
X <- data.frame(
  vowel_count = runif(ntrials, 1, 1000),
  person = sample(1:nparticipants, size = ntrials, replace = TRUE)
)
X$IQ <- runif(nparticipants, 80, 150)[X$person]
X$visual_motor_skills <- runif(nparticipants, 0, 100)[X$person]
X$person_error <- rnorm(nparticipants, 0, 0.5)[X$person]

# True model
X$accuracy <- with(X, plogis(((IQ-100)/100 - (visual_motor_skills-50)/100) * (vowel_count - 500)/1000 + person_error + rnorm(ntrials, 0, 0.5)))

# Model fitting with centered and scaled covariates
X$model_IQ <- (X$IQ - mean(X$IQ)) / sd(X$IQ)
X$model_vms <- (X$visual_motor_skills - mean(X$visual_motor_skills)) / sd(X$visual_motor_skills)
X$model_vowel_count <- (X$vowel_count - mean(X$vowel_count)) / sd(X$vowel_count)

# random intercept for each person
#    This model ignores the fact that IQ and visual motor skills are only measured once for each person
lmer1 <- lme4::lmer(accuracy ~ model_IQ*model_vowel_count + 
                    model_vms*model_vowel_count + 
                    (1 | person), data = X)
summary(lmer1)
plot(lmer1)

# random intercept for each person and random slopes for IQ and visual motor skills
#   Model without the logistic transform has singularity issues
lmer2 <- lme4::lmer(qlogis(accuracy) ~ model_IQ*model_vowel_count + 
                    model_vms*model_vowel_count + 
                    (1 + model_IQ + model_vms | person), data = X)
summary(lmer2)
plot(lmer2)

