Skip to content

Instantly share code, notes, and snippets.

@baogorek
Last active December 23, 2018 15:35
Show Gist options
  • Save baogorek/201b5073bc8512fe28b2af465215f8a4 to your computer and use it in GitHub Desktop.
Save baogorek/201b5073bc8512fe28b2af465215f8a4 to your computer and use it in GitHub Desktop.
Fitness and fatigue variables created from intensities w in data frame train_df
convolve_training <- function(training, n, tau) {
sum(training[1:(n - 1)] * exp_decay((n - 1):1, tau))
}
fitness <- sapply(1:nrow(train_df),
function(n) convolve_training(train_df$w, n, 60))
fatigue <- sapply(1:nrow(train_df),
function(n) convolve_training(train_df$w, n, 13))
E_perf <- 496 + .07 * fitness - .27 * fatigue
set.seed(45345)
train_df$perf <- E_perf + 7.0 * rnorm(nrow(train_df))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment