# 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.

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).