Dear Stan users:
I am currently using Rstan to fit a mixture of 2-component Gaussian model over T periods.
observation y_it represents the ith observation in period t and can be represented as
y_it = lambda_t * N( mu1, sigma1) + (1-lambda_t) * N(mu2, sigma2)
hence the mixture components locations and scales are the same in all time periods while only the mixing weights are time dependent.
Further, I impose the overall mixture mean lambda_t * mu1 + (1-lambda_t) * mu2 = z_t (which is a smooth function)
In order to satisfy the above equation, I let mu= (inverse(lambda’ * lambda) (lambda’(z)))
And then assign priors on lambda and z.
I formulate lambda prior as its natural parameterisation eta ~ MVN ( mu_eta, Sigma_eta) and back-transform
lambda = softmax(eta) where mu_eta and Sigma_eta have hyperpriors which are chosen in such a way that lambda is uniform between (0,1) .
To ensure identifiability, I would like to assign mu as ordered mu, however, whenever, I define this it generates lots of errors saying that mu is not a valid ordered vector, which leads to me think that perhaps I miss assign some prior constraints.
Since lambda_t is a cyclic function in my real data so I do not want to constrain lambda_t to be ordered.
Instead, I want to put some indicators function on the prior on eta such that it only draws values from my specified MVN if mu >mu.
Through reading the manual, I came across STEP function and I used in my programme, I am not sure whether this is correct or appropriate to impose such a condition.
Any suggestions are greatly welcome.
I have attached my programme ( this is only for prior distributions, there is no data involved at the moment)
visualise prior distribution.stan (1.9 KB)
In this above programme, I basically model the hyperparameters and then in the generated quantities draw eta, lambda, mu from the specified distribution which I would like to see the prior distributions of these parameters. I am not sure whether it is the right way to visualise my model with only prior distributions without actual data involved. Thanks in advance for your feedback!