Thanks, @mjskay. This is a very smart way to address the problem.
Still, because brms
and stanarm
only accept a single column of weights, only a single column of weights must be declared in the data block
. Then I could use my updated Stan model via the update command as suggested by @Guido_Biele there.
In my new dataframe data_long
the former values of the columns weights.w_1 to weights.w_10
- representing the distribution of weights
per observation - are now linked by the same value of the variable id
.
That needs to be accounted for in the data
block :
data { ...
real<lower=0>; weights[N, 10]; // data block of model weights in wide format
}
where real<lower=0> weights[N, 10]
needs to be converted into real<lower=0> weights_prime[k]
.
This k
here could be a new variable defined in the dt_long
representing the values of the variable weights
for each value of the variable id
. Not certain how to define that variable. Probably transformed data
block could be the right place to do these things.
Thanks in advance for any help.