Coxme/Surv_Stan model to Quantify Individual Consistency

Hello!

I am not sure if I am barking up the wrong tree here. Briefly, I have experimental data with 2 trials repeated across 25 subjects (individuals).
End goal: to establish some measure of consistency WITHIN subjects - so that individual A shows consistency/repeatability between his/her measures of Trial 1 and Trial 2.
Traditional solution: usually people use Pearson’s Product-Moment correlations or ICC measures.
Problem: Trials are of varying length (up to two orders of magnitude), as subject chooses when to terminate experiment. Additionally, Trials have a stressor which may result in, either, habituation or faster decision making during the second Trial. So I need a method that takes into account varying durations and trial run. This is significant because, as I am scoring behaviors, raw frequencies are prone to being influenced by trial length (the longer the trial, the more likely a behavior is to occur). Rates are not viable because duration of trial varies, consequently rates would be a function of behaviors AND trial duration, which are likely independent decisions.

Data:

head(df)
ID Date Trial Behavior Time
1 DV 11/24/2018 1 0 0.014
2 XB 11/9/2018 1 0 0.146
3 OH 11/8/2018 1 0 0.249
4 QR 6/26/2018 1 0 0.480
5 QR 6/26/2018 1 1 0.630
6 QR 6/26/2018 1 0 0.630
tail(df)
ID Date Trial Behavior Time
1753 VA 8/8/2018 2 0 966.965
1754 VA 8/8/2018 2 0 1019.915
1755 VA 8/8/2018 2 0 1045.796
1756 VA 8/8/2018 2 0 1089.331
1757 VA 8/8/2018 2 0 1126.492
1758 VA 8/8/2018 2 0 1126.492

Where ID is the subject, Date is the temporal stamp (date) for the trial run, trial is either 1 or 2. Start is the time for each of the behaviors. I recoded Behavior for input into a cox model, with 0,1 - 1 being the behavior of interest, 0 being other behaviors.

Possible solution: Two colleagues suggested Cox mixed effect models. This permits consideration of time (Duration) as a variable of significance - Behavior would be put in place of mortality. Then I could input ID as a Fixed effect and Trial as a random effect. I am not sure if this is right, and, indeed, I get some issues running it.
I was trying this:
coxme( Surv (Time, Behavior) ~ ID + (1 | Trial), data = dt)
But it would not converge - I think it is trying to use ID as a grouping variable, which is problematic (25 IDs, but only 2 trials per ID). My colleagues suggested stan_surv might not have issues converging. So I was planning to try that, if I can get it to install. Which brings me to my question.

I want to isolate individual consistency across the two trials, trying to control for trial (1 or 2) as well as the confound of varying trial duration. Given duration X, and trial Y, do individuals (1-25) show consistency in their response. So, should I be using ID as a fixed effect? Or should just be putting in Trial as a random intercept effect, and random SLOPES as well as random intercepts for ID. Then extract the Slope/Intercept values for ID? See if the posteriors differ from 0?

To be honest, I am stretching beyond my abilities here. Taken a grad course on Bayesian, comfortable in R, taken Adv Frequentist stats. I am, however, a grad student in ecology and Stats are not the focal point of my studies.

This more of a general stats question than a Stan/Bayes question, so you would be able to get more effective help somewhere like Cross Validated (https://stats.stackexchange.com/)

1 Like

Oh, thank you! Sorry. I will repost there.