Monday, March 17, 2014

Random Thoughts

Random Thoughts


I was in UK for last couple of days, and today I’ve visited Leicester City FC on the Performance and Injury conference (#LCFC_PIC). It was great to be in the great LCFC gym with same/similar-minded professionals and listen to their troubles and solutions.

I am not planning to provide an overview of the seminar besides mentioning data by Jan Ekstrand (@JanEkstrand) on injuries and providing some of my random thoughts and rationale.

Player rotation as a way of reducing injuries


There was a mention that bigger clubs (with bigger athletes/player pool) could potentially use player rotation strategies to reduce injury risk in key players and potentially save them for more important game during congested game periods. This sounds like a good plan, but not without troubles.

Here is one simple hypothetical example. First four clubs play playoffs. There is one game left to play-offs. Our team is first and decide to ‘rotate’ certain key players , to rest them for play-off. The game we are about to play is against team ranked 5th that has one point difference from 4th team, and hence a chance to qualify to play off. At the same time 4th team is playing against the team from the bottom of the table that wants to avoid relegation, or a least play-out.

If our team employs player rotation strategies and play with less than the best team, that doesn’t represent ‘level playing field’ for the team ranked 4th. Not sure how ‘moral’ is this to other teams, especially the ones that are left with a lot to fight for.  Carl Valle mentioned similar scenario happening in NBA in an awesome article Money ball Madness.

The point to be taken home is that these strategies should be discussed and some policies should be made at the league level. Hope that the above example shows why. Player rotation is simply more complex.


Coaches the cause of injury? 


Jan Ekstrand showed VERY impressive data showing injury tendencies in club with same manager/head coach – or in other way, certain injury history tend to follow the coaches whenever they go. This data is not yet available, but the UEFA has it and I think it is very interesting.

What it is interesting is that there is correlation between player availability and prizes won by these coaches regardless of the club.

Everybody is trying to bring to the attention injuries problems to the managers and educated them (or showing them the economical and performance cost of injured player and a single day missed). Maybe the solution is to add an injury history to their CV along with performance improvements and competitions won? Maybe the CEO and board should track this as well – this data might be very revealing. At the same time, maybe when this is implemented the managers/head coaches will not have the last saying in return to play protocols (“We need this guy on this game – it is the risk of re-injury we need to take. It is in the nature of our sport”). This simple tracking metric might change this culture over night. Let’s hope that this data sees the day soon, but I doubt it.

Injuries and club performance


I wrote about this interesting correlation study before (click HERE), but it is worth repeating. Apparently there is a CORRELATION (not causation) link between injuries and team performance, where teams with less injuries (time/game loss and/or occurrence)  showed higher league ranking at the end of the season.  Chicken or the egg problem IMO, even it is a common sense.

One could say that to improve team ranking one of the important goals might be to reduce injuries. This is just common sense, but it CANNOT be concluded from a study like this. The other way around could be said as well: to reduce injuries start winning games.

It is well known that overall stress reduces the coping and adaptation of athletes. Hence a losing streak is a hell of a stress and can impair adaptability and recovery of the players to the usual loads. Opposite might be true as well. If the team wins, everybody is a bit more optimistic, the hormones in the body might be better, body is coping with stress better and hence there is less injuries.

I might dig into some simple data once I get the chance – we have collected wellness questionnaire (not in a great frequency that would allow confident inferences) and I might look at the differences in scoring after a game won or game loss. We all know that wellness status might predict overtraining, illness and potentially injury (research to back up this bold claim Mladen?), but if a overall climate affect wellness, that also means it affect coping with training loads as sleep, nutrition, or coach/manager as showed by Jan Ekstrand.

Again, things are not that simple and cheesy as It sound, correlation doesn’t apply causation.


Ferrari in the traffic jam – or how to make use of physical match performance data to make erroneous conclusions


This is, I think, great analogy to explain why game physical performance data might be misleading. Data such as total distance run, high-intensity running distance or percent decrement in a last 20min of a game might not mean that the player is not able or willing to run, or even worse a proof of him be tired.

Suppose you are a proud owner of Ferrari. One day you go with your Ferrari to work. The usual distance is 10km both ways. On the way back,  at around 16:30 o’clock you got stuck in the traffic jam, so it took you 30min to come from work to home. In mathematical sense that’ s on average 20km/h. On the better days is takes 15min top and that’s around 40 km/h.  So, that day it took you double the time to cover the same distance ~ there is something definitely wrong with the Ferrari (since it cannot be ‘tired’), right?

This is pretty much the same logic we employ with match physical data. We cannot make any claims without knowing the potential and expression of that potential or in other words the contexts (tactical situation at hand). To really check if something is wrong with our Ferarri we would need to take it to the raceway where there is no (or at least minimized) constraints, so it can express his maximum potential. If things are different here (everything else being equal), then and only then this might reveal us something. Comparing the average speed it took from home to work in 12:00, 16:30 and 1:00 might just tell us about the constraints of the traffic and not much, or at all, about the car potential. It might take same time to Toyota, Fiat, Ferrari and Formula 1 to cover same distance during the rush hour.

Anyway, in physical preparation worlds, the “raceway” represent certain tests, and sometimes not always ‘sport specific’  (read more HERE). We  need to assess the potential in at least constrained and reliable environment.


If you have any comments please leave them down below.




Thursday, March 6, 2014

Analysis of Metabolic Power data using Power-Duration profile in team sports

Analysis of Metabolic Power data using Power-Duration profile in team sports

Analysis of Metabolic Power data using Power-Duration profile in team sports

Introduction

This is the idea I got from the Training and Racing with a Powermeter book by Hunter Allen and Andrew Coggan. It is an excellent and must read book on cycling, but also great book about endurance training in general.

The idea behind Power-Duration profile is that we collect instantenous Metabolic Power (in this case using GPS and tracking players) over certain period of time (e.g. one to two months duration each) and try to find maximal average MP of different durations (e.g. 5sec, 30sec, 60sec, 5min, 20min, 40min). Then we plot this and we get some insight on power cababilities of a given individual over a given time.

If we repeat this process for later period, we can compare change of the profile or selecte spots (5sec, 30sec, 5min and so forth). Although this is expression of one's capacities, by the rule of big numbers and semi-stable weekly training structures in team sports, we can gain some insights on change and individual capacities WITHOUT performing any formal tests.

Example with Catapult data

I will use the same data set as I have used in Real-Time Fatigue Monitoring using Metabolic Power and CP/W' (I suggest re-reading that one first to refresh the concepts such as Critical Power and Critical Velocity). You can download the data set HERE

The duration of the data sample is short (~400sec, with 10Hz sampling). The analysis should involve lot longer data-sets (couple of weeks of data), but making it fast in R would involve some C++ coding, or using faster algorythm than I have used here.

Here is the data and how it looks like

library(ggplot2)

sampling <- 1/10

# Load CVS data from Catapult Export File, Sampling = 10Hz
Catapult.data <- read.csv("Catapult GPS Data.csv", header = TRUE, skip = 7, 
    stringsAsFactors = FALSE)

# Clear up the data
Catapult.data$X <- NULL

# Create time vector, since we know sampling frequency of 10Hz
Catapult.data$Time <- seq(from = 0, by = sampling, length.out = length(Catapult.data$Metabolic.Power))

# Visualize the data using ggplot2
gg <- ggplot(Catapult.data, aes(x = Time, y = Metabolic.Power))
gg <- gg + geom_line(color = "black", alpha = 0.6, size = 0.5)
gg <- gg + theme_bw()
gg

plot of chunk unnamed-chunk-1

The fist step in establishing Power-Duration profile is to calculate moving averages (MA) across the data. In the example below I have created moving averages of 5sec and 30sec duration. As you can see the are 'smoothing' the data (this procedure is sometimes used to filter the noise)

gg <- ggplot(Catapult.data, aes(x = Time, y = Metabolic.Power))
gg <- gg + geom_line(color = "black", alpha = 0.6, size = 0.5)

gg <- gg + geom_line(y = filter(Catapult.data$Metabolic.Power, rep(1, 5/sampling), 
    sides = 1)/(5/sampling), color = "blue", size = 1)

gg <- gg + geom_line(y = filter(Catapult.data$Metabolic.Power, rep(1, 30/sampling), 
    sides = 1)/(30/sampling), color = "yellow", size = 1)

gg <- gg + theme_bw()
gg

plot of chunk unnamed-chunk-2

You can see that MA 'smoothens' the data - the longer the movign window (i.e. 30sec to 5sec) the 'smoother' the data.

The next step is to take out the maximum from the smoothed data. For the sake of example I will pull out maximum of the raw MP, maximum of 5sec MA and maximum of 30sec MA.

sprintf("Raw signal maximum: %.2f W", max(Catapult.data$Metabolic.Power, na.rm = TRUE))
## [1] "Raw signal maximum: 86.62 W"

sprintf("5sec MA signal maximum: %.2f W", max(filter(Catapult.data$Metabolic.Power, 
    rep(1, 5/sampling), sides = 1)/(5/sampling), na.rm = TRUE))
## [1] "5sec MA signal maximum: 37.40 W"

sprintf("30sec MA signal maximum: %.2f W", max(filter(Catapult.data$Metabolic.Power, 
    rep(1, 30/sampling), sides = 1)/(30/sampling), na.rm = TRUE))
## [1] "30sec MA signal maximum: 16.46 W"

These represent maximal MP over 5sec window and 30sec window. We know from physiology that the longer the duration one can produce less power. Hence, the 5sec max power is higher than 30sec max power.

The next step is to calculate maximums for different MAs over a signal. We can create a for loop and pull out maximums for different time windows.

Here is the code and graphical representation

# Define the increase in time windows. The lower is slower, but more
# precise. In longer data sets 5-10sec might be needed. Here (since it is a
# small data set) we use 1
step.value <- 1

# Create a variable to store maximums
power.duration.profile <- data.frame(power = 0, duration = seq(from = 1, to = 390, 
    by = step.value))

for (i in seq_along(power.duration.profile$duration)) {
    seconds <- power.duration.profile$duration[i]
    power.duration.profile$power[i] <- max(filter(Catapult.data$Metabolic.Power, 
        rep(1, seconds/sampling), sides = 1)/(seconds/sampling), na.rm = TRUE)
}

# Draw the curve
gg <- ggplot(power.duration.profile, aes(x = duration, y = power))
gg <- gg + geom_line(color = "red", size = 1)
gg <- gg + theme_bw()
gg

plot of chunk unnamed-chunk-4

As we can see from the graph there is inverse relationship between Power and duration. This is a common output.

Let's write a function to calculate CP/W from this data set (see more in Rationale and resources for teaching the mathematical modeling of athletic training and performance).

criticalPower <- function(data) {
    output <- list(CP = 0, W = 0)

    duration <- data$duration
    power <- data$power

    duration <- 1/duration

    model1 <- lm(power ~ duration)

    output$CP <- coef(model1)[[1]]
    output$W <- coef(model1)[[2]]

    criticalPower <- output
}

And we apply this function to our curve (Power-Duration profile)

print(criticalPower(power.duration.profile))
## $CP
## [1] 11.31
## 
## $W
## [1] 74.24

In this case CP is ~11W. PLEASE note that this CP/W analysis should come from real testing data (testing capacities vs. expressing them as shown here). Anyway, if we create this Power-Duration profile over a longer period, we can assume that during that period the athlete gave his best effort over a given duration.

To wrap this up, I will replot the caluclated Power-Duration curve and add CP line (shown as dashed line).

# Calculate the CP
CP <- criticalPower(power.duration.profile)$CP

# Draw the curve
gg <- ggplot(power.duration.profile, aes(x = duration, y = power))
gg <- gg + geom_line(color = "red", size = 1)
gg <- gg + theme_bw()
gg <- gg + geom_hline(yintercept = CP, linetype = "dashed")
gg

plot of chunk unnamed-chunk-7

If we repeat this for every motnth or two worth of data, we can MAYBE get CP/W without actually testing players with formal test.