# Write Stan model when y variable is a combination of other variables and does not have error on its own

I have the following toy example:

y_{ij} = a_i+\beta*b_j,

where

a_i, b_j follows standard normal.

Typically, if there is an error component to the model, e.g.,

y_{ij} = a_i+\beta*b_j+e_{ij},

I write the model as


y_i ~ normal (a_i+beta*b_j,sd_e);



However, there is no error component to my model.

I want something like


y_i ~ normal (a_i+beta*b_j,0);



But it will break the model.

Well, I can’t say that I can think of a situation where this would be needed; however, you don’t need a normal distribution in this case if there is no error. From what I understand, you’re saying that the linear equation y_{ji} = \alpha_i + \beta*b_j is exact and has no error at all, meaning there’s no need to specify a distribution for this as there’s no error or variance.

In other words, you model block would just be the following (I think):

model {
alpha ~ std_normal();
beta ~ std_normal();

for ( i in I)
y = alpha[i] + beta * x;
}


Perhaps you can share some more information as to why you believe that there will be uncertainty in the coefficient//intercept but not at all in the outcome variable as that seems to be an unlikely circumstance in my mind — I can’t think of a circumstance where there would be uncertainty in the parameters but no uncertainty in the prediction of the observed data

2 Likes