# Repeated-measures, crossover analysis using linear mixed model in R

I have a data set that I am attempting to analyse in R and I am relatively new to the environment.

My full data set contains 7 subjects (represented by Subject), that all receive 3 treatments (environmental conditions, represented by Altitude) and are measured 10 times within each treatment. Each participant received each treatment in a different order, represented The measurements are power (from a treadmill, represented by Power) during repeated-sprint efforts (represented by Sprint). An example: I also have characteristics about each subject that may influence their power effort, including weight, capacity tests and age. I am interested in the effect of each Environment on the Sprint results, plus the effect of order on the Power.

I believe a linear mixed model, with subject as a random effect, is an appropriate tool to investigate my dataset. I have attempted this using the following line:

alt.model = lmer(Power ~ Sprint + Altitude + VO2max + (1|Subject), data=ALTMM)

However, I don't think this accounts for each individual sprint. How do I represent this?

Thank you.

## 1 Answer

Every observation is an individual sprint if I understand you correctly. Thus, there are as many observations as there are sprints. This means that you cannot include the individual sprint as an fixed effect as this would give a perfect fit.

It cannot be included as a random effect either. This is because the factor describing the individual sprint is identical to the factor consisting of observation numbers. The latter factor is what is used for the error term of your model. Thus, it will not be identifiable what portion comes from each of the two variance componenents as they are defined by the same factor.

If you try fitting a model with this issue using ${\tt lmer}$ of the ${\tt lme4}$ you'll get an error telling you that grouping factors of random effects should have fewer levels than there are observations in data. Using ${\tt lme}$ of ${\tt nlme}$ you can fit the model but it'll just split the variation between the two variance components in some arbitrary way (to the best of my knowledge).

Actually, you could say that the above model already takes the individual sprint into account. One is just not able to seperate the effect from the measurement error.