Skip to content

Instantly share code, notes, and snippets.

@baogorek
Last active March 5, 2019 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save baogorek/fd8044630383e6cb4f34b32cccd6c0a8 to your computer and use it in GitHub Desktop.
Save baogorek/fd8044630383e6cb4f34b32cccd6c0a8 to your computer and use it in GitHub Desktop.
library(ggplot2)
# Figure 1
plot_df <- rbind(
data.frame(day = days_grid, level = phi, type = "true \u03D5(t)"),
data.frame(day = days_grid, level = eta_star, type = "best fit \u03B7*(t)")
)
ggplot(plot_df, aes(x = day, y = level, color = type, linetype = type)) +
geom_line(size = 2) +
ggtitle("Total system impulse response for H.T.'s training") +
xlab("Day (n)") + ylab("Lag distribution value") +
theme(text = element_text(size = 16))
# Figure 2
plot_df <- rbind(
data.frame(day = days_grid, level = phi, type = "true \u03D5(t)"),
data.frame(day = days_grid, level = eta_hat, type = "fitted \u03B7(t)")
)
ggplot(plot_df, aes(x = day, y = level, color = type, linetype = type)) +
geom_line(size = 2) +
ggtitle("Spline-based estimation of impulse response \u03D5(t)") +
xlab("Day (n)") + ylab("Lag distribution value") +
theme(text = element_text(size = 16))
# Figure 3
ggplot(train_aug_df) +
geom_point(aes(x = day, y = perf)) +
geom_line(aes(x = day, y = perf_hat_fitness_fatigue, color = "blue"),
size = .9) +
geom_line(aes(x = day, y = perf_hat, color = "dark orange"), size = .9) +
ggtitle("Performance, observed and modeled") +
xlab("Day (n)") + ylab("Performance") +
theme(text = element_text(size = 16)) +
scale_colour_manual(name = "model",
values =c("blue" = "blue","dark orange" = "dark orange"),
labels = c("fitness-fatigue", "spline-based"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment