Hi,
I'm a statistics beginner and I have been spending to many hours trying to figure this out so I finally seek your help with crossed fingers.
I have two groups: injured (=1) and healthy (=0). 30 individuals in each group. The injured were measured (with AAe, NDI, DHI and VAS) at 2 points in time (pre and post treatment) and the healthy were measured with (AAe, NDI and VAS) once
I want to see the effects of DHI, NDI and VAS on the AAe variable
I'm trying to code a mixed model using "lmer" with dependent variable (response variable) "AAe", response variables "NDI", "VAS" and "DHI", with time ("Pre_Post") as a within subjects factor and group (0 or 1, "Group") as a between groups factor.
To complicate things, I mention again: the healthy group did not do the "DHI" test
To complicate more: I marked the healthy group as "pre" in the pre_post column. Not sure if that is correct to do.
so far I have tried this:
lmer1<-lmer(AAe~Pre_Post*Group+NDI+DHI+VAS+(1|ID),data=Dat)
summary(lmer1)
but I get this error:
"fixed-effect model matrix is rank deficient so dropping 2 columns / coefficients"
Is this because I am trying to involve the "DHI" variable when it wasn't used on the healthy group?
If I remove the "Group" input and put "Sex" instead I get these results:
but I have no idea if this is correct or even what the results are telling me as I see no p-value
Can anyone tell me if I am coding this the right way? Should I do two models instead? One to assess the effects of DHI, NDI and VAS on AAe with time as within subjects factor and another to assess effects of NDI and VAS on AAe with group as a between group factor?
This S/O post has a helpful explanation of the warning message. Without a reprex (see the FAQ, there's not much helpful that can be said about your design except to say that it is often helpful to start with the simplest case and only add complications stepwise. Thus, start with the first example in help(lmer)
library(lme4)
#> Loading required package: Matrix
## linear mixed models - reference values from older code
(fm1 <- lmer(Reaction ~ Days + (Days | Subject), sleepstudy))
#> Linear mixed model fit by REML ['lmerMod']
#> Formula: Reaction ~ Days + (Days | Subject)
#> Data: sleepstudy
#> REML criterion at convergence: 1743.628
#> Random effects:
#> Groups Name Std.Dev. Corr
#> Subject (Intercept) 24.741
#> Days 5.922 0.07
#> Residual 25.592
#> Number of obs: 180, groups: Subject, 18
#> Fixed Effects:
#> (Intercept) Days
#> 251.41 10.47
summary(fm1)
#> Linear mixed model fit by REML ['lmerMod']
#> Formula: Reaction ~ Days + (Days | Subject)
#> Data: sleepstudy
#>
#> REML criterion at convergence: 1743.6
#>
#> Scaled residuals:
#> Min 1Q Median 3Q Max
#> -3.9536 -0.4634 0.0231 0.4634 5.1793
#>
#> Random effects:
#> Groups Name Variance Std.Dev. Corr
#> Subject (Intercept) 612.10 24.741
#> Days 35.07 5.922 0.07
#> Residual 654.94 25.592
#> Number of obs: 180, groups: Subject, 18
#>
#> Fixed effects:
#> Estimate Std. Error t value
#> (Intercept) 251.405 6.825 36.838
#> Days 10.467 1.546 6.771
#>
#> Correlation of Fixed Effects:
#> (Intr)
#> Days -0.138