Thanks for the help.
Lets assume this is the original model:
with pm.Model() as m:
alpha = pm.Beta('alpha', 1,1, shape=n_subj) beta = pm.Normal('beta',0, 1, shape=n_subj) eps = pm.HalfNormal('eps', 5) Qs = 0.5 * tt.ones((n_subj,2), dtype='float64') # set values for boths stimuli (CS+, CS-) vec = 0.5 * tt.ones((n_subj,1), dtype='float64') # vector to save the relevant stimulus's expactation [Qs,vec, pe], updates = theano.scan( fn=update_Q, sequences=[stim, shock], outputs_info=[Qs, vec, None], non_sequences=[alpha, n_subj]) vec_ = vec[trials, subj,0] * beta[subj] scrs = pm.Normal('scrs', mu = vec_, sd = eps, observed=scrMat) # add matrix of expected values (trials X subjects) ev = pm.Deterministic('expected_value', vec_) # add PE pe = pm.Deterministic('pe', pe) tr = pm.sample(target_accept=.9, chains=4, cores=10, return_inferencedata=True)
the function receives matrices of stim and shock (ntrials X subjects).
Later on, I use a similar structure for the scrMat (observed variable to fit, SCR with ntrials X nSubs as well).
So, as long as the matrices have the same size, I can send each of the three options of matrices to the same scan, just at different times. Next, I need to fit everything with the likelihood function, I can also split it into three? wouldn’t it be as if a just run each set of subjects separately?