I’m trying to find latent variable from observed data produced by the sum of 2 random variables.
This is the python code producing the simulated data :
data = []
for p in range(1000): #paniers
s = np.random.exponential(scale=10,size=2).sum()
data.append(s)
This builds 1000 data points, each of them is the sum of two random draws from the same exponential random variable.
Below is my incomplete model. I’m trying to find the latent variable beta, which is the parameter of the exponential random variable used to create the data.
data {
int<lower=0> N;
real observed[N];
}
parameters {
real<lower=0,upper=100> beta;
}
model {
real e;
real s;
s = 0;
for (i in 1:2)
e ~ exponential(beta);
s += e;
observed ~ ????
}
How do I replace the ??? to ‘connect’ my observed data to my model ?
Any help appreciated.