This is my example: My problem's dimension is 1000 and my target distribution is a standard normal distribution and I have a vector x (size 1000x1) which i set it as the initial values of my problem for the HMC NUTS sampling.
I also attach the figure to show you what i mean by saying the initial values for each chain.
(Lately, I have done the whole process with MCMC metropolis in Matlab but now I want to use this feature of Stan to make it more efficient with the NUTS.)
I would gratefully appreciate it if you could let me know whether I'm doing it correctly or not.
N = dimension of my problem, and ux = Initial state of each dimension
for the Markov Chain. I'm trying to implement the HMC NUTS sampling
technique
and the density (target distribution) will be the standard normal distribution as you can see in the following code.
Hi all,
I'm a newcomer in Stan. I wanted to implement the Stan on a toy example.
I want to make sure whether I'm on the right track.
This is my Stan code:
data {
int<lower=1> N;
}
parameters {
real x[N];
}
model {
for (n in 1:N)
x[n] ~ normal(0, 1);
}
load('Ufile.mat'); // Load my initial states which is the vector of ux
N = length(ux);
MCMC_dat = struct('N',N);
initial = struct('x',ux');
fit = stan('file','MC.stan','data',MCMC_dat,'chains',1,'iter',10,'init',initial,'algorithm','NUTS','sample_file','output-6.csv');
%print(fit)
It is the part of a technique to estimate the small failure probabilities in high dimensions.
This method expresses probability of failure (Pf) as a product of conditional probabilities that are significantly larger than Pf. These conditional probabilities are estimated by application of Markov Chain Monte Carlo (MCMC) sampling.
These samples are used as “seeds” for generating additional samples conditional on F1 (based on figure) at simulation level 1.
The
seeds -which are the initial values as I mentioned before - for generating
conditional samples at Level i are discarded after use. This provides some
convenience in sample accounting and analysis of the failure
probability estimate. It also reduces the correlation between the samples at
different simulation levels.
I attach the figure for more clarification about the technique.
My toy example is very similar to example 4.1.1 250-dimensional multivariate normal (MVN) in the paper of Hoffman & Gelman: The No-U-Turn Sampler:…..
But with this difference that I have the initial values as I mentioned above and my problem's dimension is 1000.
So, based on above explanation, Do you think my Matlab and Stan code is correct?
Thank
you very much for your consideration.
Regards,
Hamed