I'm having problems understanding how to interpret correlations in mixed models
sub <- c(1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,8,8,8,8,9,9,9,9,10,10,10,10)
f1 <- c(13,13,17,22,29,21,12,34,22,26,28,29,11,11,14,12,18,12,9,33,33,38,22,37,12,16,22,21,11,10,10,10,22,23,35,21,2,3,5,6)
f2 <- c(22,25,33,13,21,33,12,2,26,22,33,31,21,26,27,26,21,11,14,17,45,37,34,35,31,27,29,39,10,12,12,14,17,12,13,14,10,10,10,10)
y <- c(12,14,21,19,25,32,21,22,33,23,28,32,14,15,18,14,18,12,11,21,33,43,32,38,9,9,21,19,16,14,14,14,21,11,44,41,14,11,11,10)
dat <- data.frame(sub=sub, f1=f1, f2=f2, y=y)
m <- lmer(y ~ f1 + f2 + (1|sub) ,data=dat)
Fixed effects:
Estimate Std. Error df t value Pr(>|t|)
(Intercept) 4.7549 3.2024 12.1903 1.485 0.163
f1 0.6502 0.1256 27.5841 5.178 1.78e-05 ***
f2 0.1813 0.1214 25.0848 1.493 0.148
My questions are:
1) how can I extract the individual correlations between f1
and y
, and between f2
and y
from m
? Do I need to create separate models for each predictor?
2) how can I interpret the significant Estimate of f1
? Is it accurate to say that a unit increase in f1
changes the y
by 0.65
?
3) the summary
function tells me that the correlation between predictors is -0.31
but cor.test(dat$f1,dat$f2)
gives me 0.42
. I know I'm overlooking something but I wonder what.