How bad is this pp_check? Should I alter the distribution?

:)

Something like:

response ~ s(distance, by = treatment) + 
            (treatment|individual) + 
            (distance|individual:trial)

I have very little experience with gamms in brms so I am not at all sure about the correct specification of the group level terms here. Maybe @ucfagls can correct me here?

I think that once you account for the exponential decay of the angle differences this may also take care of the skewness. In other words, when you try this, start with Gaussian ;)

2 Likes

OMG cool! I started playing with splines today, looks like Iā€™m on the right track!

Okay, can you please help me by breaking down the reasoning for this specific structure and explain index-type and contrast-type models? Or alternatively provide some resources to help me understand? Iā€™ve never heard of index vs contrast type.

Oh no worries, @Solomon has you covered.

Again, gam(m)s are a different beast and I may be way off for the random terms.

2 Likes

This starts to sound like time to actually include this information in the same way as @andrewgelman did in the case study Model building and expansion for golf putting

3 Likes

Maybe you can try a ā€œunimodalā€ arbitrary function. This would get the main peak, and probably not the others, although as stated in the unimodal approac here

it could also get the other small modes.
(Summary: instead of using a parametric curve as a gaussian or beta, you bin the continuous curve in n+m bins with the mode at m, and then you create a curve that adds n times a half gaussian, and the substracts m times a half gaussian. Of course that you only fix n+m, and you let STAN inder how much is n.)

treatment doesnā€™t sound like anything that youā€™d want to be a random effect

Agreed. But unless my syntax is wrong (not unlikely), individual and trial are the random effects. Treatment varies by individual.

Now I see my syntax was wrong in that I forgot to include treatment as a population level predictor.

response ~ treatment + s(distance, by = treatment) + 
            (treatment|individual) + 
            (distance|individual:trial)
1 Like

Ugg, I completely misread the intention of the random effect - what you have now is just fine