Songbird on paired samples

In my example I have subject ids directly coded : https://gist.github.com/mortonjt/9d336566c83541e9c80f0f78c3a97750#file-negative-binomial-random-effects-stan-L9

This would require a small update to the input to the stan model highlighted in the above tutorial via

dat = {
    'N' : X.shape[0],
    'D' : table.shape[0],
    'p' : X.shape[1],
    'depth' : np.log(table.sum(axis='sample').values),
    'x' : X.values,
    'y' : table.values.astype(np.int64)
    'subj_ids' : <something goes here>
}

where subj_ids is some numeric conversion of your actual host subject ids.

There are also quite a bit of documentation on stan that I recommend checking out : https://mc-stan.org/docs/2_25/stan-users-guide/index.html.

Also stan has its own channel ; for instance this page highlights an example fitting mixed effects models : https://discourse.mc-stan.org/t/linear-mixed-effects-model-with-varying-intercept-and-slope-in-matrix-notation/7308/3

1 Like