I performed mixed model ANOVAs using the lmer function from lme4.
My model is as follows.
mixedhrt<-lmer(HR_COR~Optimel+Order+Gender+SipSize +Hunger + GHI+(1|Participant),data=Taste2)
I want to see the effect of package condition, the order of my blocks, gender, the sip size, hunger ratings and general health interest on heart rate.
The structure of the data:
'data.frame': 498 obs. of 8 variables:
$ Participant : Factor w/ 98 levels "2","3","4","5",..: 1 1 1 1 1 2 2 2 2 2 ...
$ Optimel : Factor w/ 5 levels "BHL","BLH","Practice",..: 1 2 3 4 5 1 2 3 4 5 ...
$ HR_COR : num 6.091 5.855 -0.773 NA 2.676 ...
$ Hunger : num 1.5 1.5 1.5 1.5 1.5 13.7 13.7 13.7 13.7 13.7 ...
$ Order : Factor w/ 5 levels "0","1","2","4",..: 2 3 1 4 5 3 5 1 2 4 ...
$ SipSize : num 12.6 13.8 11.3 13.2 13.0 11.6 9.9 10.7 12.3 13.1 ...
$ Gender : Factor w/ 2 levels "male","female": 2 2 2 2 2 2 2 2 2 2 ...
$ GHI : num 6 6 6 6 6 5 5 5 5 5 ...
When running anova(mixedhrt)
I get the following output:
fixed-effect model matrix is rank deficient so dropping 1 column / coefficient
fixed-effect model matrix is rank deficient so dropping 1 column / coefficient
fixed-effect model matrix is rank deficient so dropping 1 column / coefficient
fixed-effect model matrix is rank deficient so dropping 1 column / coefficient
fixed-effect model matrix is rank deficient so dropping 1 column / coefficient
fixed-effect model matrix is rank deficient so dropping 1 column / coefficient
fixed-effect model matrix is rank deficient so dropping 1 column / coefficient
Analysis of Variance Table of type II with Satterthwaite approximation for degrees of freedom
Sum Sq Mean Sq NumDF DenDF F.value Pr(>F)
Optimel 35.840 8.960 4 328.90 1.1218 0.34608
Order 183.865 61.288 3 328.22 7.6733 5.698e-05 ***
Gender 10.714 10.714 1 85.53 1.3414 0.25001
Hunger 2.288 2.288 1 85.72 0.2865 0.59388
GHI 6.168 6.168 1 84.32 0.7723 0.38201
SipSize 33.142 33.142 1 392.39 4.1494 0.04232 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
I am interested in which order factors are significantly different from each other (pairwise comparison). When I perform the lsmeans function lsmeans(mixedhrt, pairwise ~ Order)
on the lmer model, I only receive the contrasts for order factors 1,2,4,5 and no contrasts with factor 0.
$lsmeans
Order lsmean SE df asymp.LCL asymp.UCL
0 NA NA NA NA NA
1 NA NA NA NA NA
2 NA NA NA NA NA
4 NA NA NA NA NA
5 NA NA NA NA NA
Results are averaged over the levels of: Optimel, Gender
Degrees-of-freedom method: satterthwaite
Confidence level used: 0.95
$contrasts
contrast estimate SE df t.ratio p.value
0 - 1 NA NA NA NA NA
0 - 2 NA NA NA NA NA
0 - 4 NA NA NA NA NA
0 - 5 NA NA NA NA NA
1 - 2 1.32707259 0.4381103 327.41 3.029 0.0221
1 - 4 1.24663731 0.4434918 328.08 2.811 0.0415
1 - 5 2.06891027 0.4379091 328.43 4.725 <.0001
2 - 4 -0.08043529 0.4380253 328.92 -0.184 0.9997
2 - 5 0.74183767 0.4390263 328.85 1.690 0.4417
4 - 5 0.82227296 0.4433427 327.58 1.855 0.3441
Results are averaged over the levels of: Optimel, Gender
P value adjustment: tukey method for comparing a family of 5 estimates
My guess is, that it has to do with the rank deficiency, which in turn has to do with the nature of my data. I have 5 order time points (0,1,2,4,5). During time points 1,2,4,5 I tested one of 4 different conditions, whereas time point 0 was a practice run and was therefore always the same condition. The conditions are classified through the variable Optimel. Therefore, there seem to be issues with the calculations, as the anova also only returns 3 NumDF
, where there should be 4. I'm afraid I'm lacking necessary statistical and R knowledge to understand how to deal with this. Therefore, I would be very grateful for any help on possibilities to calculate all contrasts with my current data structure.