I am running almost the simplest model possible: estimating the mean of sample drawn from a normal. I treat the mean as the state with the standard deviation as a parameter.
> model MV {
> param sigma;
> state mu;
> obs x;
> noise eta;
>
> sub parameter {
> sigma ~ uniform(0.0, 1.0);
> }
>
> sub proposal_parameter {
> sigma ~ truncated_gaussian(sigma, 0.1, 0.0, 1.0);
> }
>
> sub initial {
> mu ~ normal(0.0, 1.0);
> }
>
> sub transition {
> eta ~ normal(0.0, 1.0e-6);
> mu <- mu + eta;
> }
>
> sub observation {
> x ~ normal(mu, sigma);
> }
> }
I’d like to draw the particle paths for each Markov chain step but if I do e.g.
> bi_object$run(add_options = list(
> "end-time" = T,
> noutputs = T,
> nsamples = 8,
> nparticles = 32,
> seed=42,
> nthreads = 1),
> verbose = TRUE,
> sampler="smc2",
> stdoutput_file_name = tempfile(pattern="pmmhoutput", fileext=".txt"))
>
> bi_file_summary(bi_object$result$output_file_name)
I get
> Summary of file /private/var/folders/3p/m593dprn5snbjz6sc45c77f80000gn/T/RtmpqWLBkv/MV_outputeaff7423f4da.nc
> [1] "2016-12-20 09:46:38 GMT"
> File /private/var/folders/3p/m593dprn5snbjz6sc45c77f80000gn/T/RtmpqWLBkv/MV_outputeaff7423f4da.nc (NC_FORMAT_NETCDF4):
>
> 8 variables (excluding dimension variables):
> double time[nr] (Contiguous storage)
> double eta[np,nr] (Contiguous storage)
> double mu[np,nr] (Contiguous storage)
> double sigma[np] (Contiguous storage)
> double loglikelihood[np] (Contiguous storage)
> double logprior[np] (Contiguous storage)
> double logweight[np] (Contiguous storage)
> double logevidence[nr] (Contiguous storage)
>
> 2 dimensions:
> nr Size:51
> np Size:8
>
> 3 global attributes:
> libbi_schema: SMC
> libbi_schema_version: 1
> libbi_version: 1.2.0
The LibBI manual tantalisingly talks about `np` being the number of particles when a particle filter is chosen. I assume SMC (`libbi_schema: SMC`) is somehow not a particle filter? I have also tried `pmmh` and get `libbi_schema: MCMC` again with the dimensions of the time steps and the chains.
Anyhow the TL;DR is: how do I get hold of the particle paths? In case it isn’t obvious I am using the `R` `rbi` package.
Many thanks,
Dominic Steinitz
dom...@steinitz.org
http://idontgetoutmuch.wordpress.com