currently, if you model your data and you have some missed trials, you remove them from the data before modelling which is projected in the prep data by
Tsubj being less than
T. Then in the predictions STAN gives, it adds
T-Tsubj rows of value -1 for each subject. I would like to ask if there is a plan to add those -1 values to where they actually belong, where they are missing, and not to the end.
So for example, if I have trials 1,2,5 it will not give me y1,y2,y3,-1-1 but rather y1,y2,-1,-1,y5.
I guess it is quite a complex task but it would be very helpful.
I think the easiest way to handle this sort of processing will be using array indexing, probably outside of Stan.
In R something like:
y = c(1, 2, 3, 4, 5)
trials = c(1, 2, 5)
y_sub = y[trials]
And then do your stan model, and then:
y_rep = matrix(-1, nrow = N, 5)
# Assuming y_rep_subj is an Nx3 matrix of N draws of 3 predictions
y_rep[, trials] = y_rep_subj
Mess around with the code here to get the hang of what is happening:
y = matrix(-1, nrow = 10, ncol = 5)
y[, c(1, 2, 5)] = matrix(3, nrow = 10, ncol = 3)
Yes, that what I was doing outside with Python as well, gets a bit tricky with more subjects/dimensions of the data. That’s why I was asking if there is any incentive to do that inside STAN.
Thanks for the reply.