I have a large local positioning (LPS) dataset from a motor learning experiment with elite ski racers learning to pump in slalom. In the experiment, we instructed the skiers to ski straight down the hill (COURSE SG), and we wanted to compare their performance in three slalom courses relative to the condition when they skied straight down the hill. The details are not important here, but an interested reader may read the paper: Frontiers | Is there a contextual interference effect for sub-elite alpine ski racers learning complex skills?.
For the current analysis, I want to explore the kinematic changes that occurred from the pre-test (baseline) to the post-test (retention). Therefore, the first analysis will be a time analysis of the whole section of the slalom course, which I thought I could analyze with GAM models in brms. I, therefore, took a course on GAMs last week. However, I am unsure how to write the models in brms, so I hope someone here can help me get started. I have included two figures with different DVs.
I want a different smooth for each factor(course) and each factor(day), but it should also be possible to allow factor(course) and factor(day) to interact. Does this make sense, and is this possible? So far, I have the following model:
modA <- brm(data = df, family = gaussian, performance ~ 1 + course + s(sectionIndex, by = course) + (1|bib), prior = c(prior(normal(0, 10), class = Intercept), prior(normal(0, 10), class = b), prior(student_t(3, 0, 5.9), class = sds), prior(exponential(1), class = sigma)), iter = 500, warmup = 300, chains = 2, cores = 2, seed = 4)
I have included a random intercept for each skier in the experiment. Each skier has three runs on baseline and retention.