I would like to test the effect of mean gait speed on stride errors from 2 different sensors (IMUs), such that we obtain a linear slope for the error versus speed for each sensor. In addition, we would like to compare the performance of the 2 sensors, so that we would need to include an interaction effect of speed and type of sensor.
My dataset looks like this:
I have tried running this but it doesn't work and not sure why
"
rm(list = ls())
library(readxl)
exceldata = read_excel("C:\Users\gerar\Desktop\UMASS\M.S THESIS\Results\Stride70errorCombined.xlsx")
dfdata = data.frame(exceldata)
Define IMU and Participant as factors
dfdata$Participant=as.factor(dfdata$Participant)
dfdata$IMU=as.factor(dfdata$IMU)
library(lmerTest)
library(lme4)
Fit model. Note:an interaction automatically provides main effects of Speed and IMU
M4 <- lmer(Error ~ Speed*IMU + (0+IMU|Participant),REML=FALSE,data=dfdata)
summary(M4)
anova(M4)
"
The error I get when running the M4 command is: Error: number of observations (=35) <= number of random effects (=36) for term (0 + IMU | Participant); the random-effects parameters and the residual variance (or scale parameter) are probably unidentifiable
Any help would be very much appreciated!