[R-sig-ME] One model of two subsets of data
Timothy MacKenzie
|@w|@wt @end|ng |rom gm@||@com
Fri Jun 9 21:29:20 CEST 2023
Hello All,
I have two questions:
First, I was wondering if "model_2" (even subset of items in model_1)
and "model_3" (odd subset of items in model_1) results (fixed and
random) can be derived from model_1?
Second, from "model_2" and "model_3", suppose I draw the `Subject`
random effects and correlate them:
ranef_model_2_even = data.frame(ranef(model_2)$Subject)
ranef_model_2_even$Subject <- row.names(ranef_model_2_even)
ranef_model_3_odd = data.frame(ranef(model_3)$Subject)
ranef_model_3_odd$Subject <- row.names(ranef_model_3_odd)
Subject = merge(ranef_model_2_even, ranef_model_3_odd, by = "Subject",
suffixes = c("_even", "_odd"))
cor(Subject$Conditionunrelated_even, Subject $Conditionunrelated_odd)
# [1] 0.849635
**** Could we obtain the latent equivalent of the above correlation
(which may not be numerically the same as 0.849635) from
`VarCorr(model_1)`?
Thank you all, Tim M
## Reproducible data and code:
d = read.csv("https://raw.githubusercontent.com/fpqq/w/main/d3.csv")
library(optimx)
library(blme)
model_1 = blmer(I(-1/RT) ~ Condition:item_num +
(Condition:item_num|Subject) + (Condition:item_num|Item), data = d,
control=lmerControl(optimizer="optimx",optCtrl=list(method="nlminb")))
# Subset 1:
model_2 = blmer(I(-1/RT) ~ Condition + (Condition|Subject) + (Condition|Item),
data = d, control=lmerControl(optimizer="optimx",optCtrl=list(method="nlminb")),
subset = item_num == "Even")
# Subset 2:
model_3 = blmer(I(-1/RT) ~ Condition + (Condition|Subject) + (Condition|Item),
data = d, control=lmerControl(optimizer="optimx",optCtrl=list(method="nlminb")),
subset = item_num == "Odd")
More information about the R-sig-mixed-models
mailing list