Consider, "y" as the dependent variable and "x1" and "x2" as the independent variables. Consider two categorical variables "GROUPING" and "REGION" with 2 levels each. Consider data_model with all the variables.
Consider 2 lmer models,
data_model_R1 = subset(data_model, REGION=='R1')
formula_R1 = "y ~ 1 + x1 + x2 + (1 + x1 | GROUPING) + (1 + x2 | GROUPING)"
model_R1 = lmer(formula_R1 , data_model_R1)
data_model_R2 = subset(data_model, REGION=='R2')
formula_R2 = "y ~ 1 + x1 + x2 + (1 + x1 | GROUPING) + (1 + x2 | GROUPING)"
model_R2 = lmer(formula_R2 , data_model_R2)
How can I create an equivalent "model" with one formula to get all the coefficients generated in "model_R1" and "model_R2"? Something like,
model = lmer(formula, data_model)