Hi there, I have a question related to the sequence that different blocks in Stan are executed. Lets say I have the following toy example . I want to 1) get sample a, 2) apply a function on it to generate a_transformed, 3) use a_transformed as a parameter of distribution distr_2.
I wonder is this a valid workflow? It runs but I am not sure in terms of the order that model block and transformed_parameters block run, does it do the thing I expect and is the computation graph created as I expect? I mean does Stan figure out this dependency properly?
data {
}
parameters {
real<lower=0.0, upper=1.0> sensitivity;
real<lower=0.0, upper=1.0> sensitivity_new;
}
transformed parameters {
real sensitivity_transfomed = sensitivity * 5 + 2;
}
model {
sensitivity ~ beta(5.0, 2.0);
sensitivity_new ~ beta(sensitivity_transfomed, 3.0);
}
Thanks for your help and answering my noob question.