Slice sampling in Particle Gibbs with Ancestral Sampling Bear with me as I am not from statistical background. My question is about the implementation of PGAS algorithm as given in Lindsten et. al 2014 concerning sampling in state-space models. The two algorithms in question taken from the aforementioned paper are given below:

The algorithm makes use of PGAS Markov kernel as given below.

I essentially have two (possibly naive) questions:

*

*For sampling the hyperparameters, $\theta[n]$ above, I am using Metropolis-Hastings or slice sampling. As the sampling generally has a burn-in period, I suppose I always run the sampler for say $K$ iterations and take only the $K^{\text{th}}$ sample? If this is the way to go, it seems waste of computation time. Or are there other ways like generating $K+M$ samples and then sampling uniformly from the $M$ later samples which does not make much sense to me to be honest? What should the value of $K$ (or $M$ if applicable) be ideally?

*Second question is about the optimality/learning of the hyperparameter $\theta$. I want to know how the algorithm learns the optimal (in some sense) $\theta$. I can see how the improvement is trajectory, $x_{1:T}[n]$, forces the conditional $p(\theta \vert x_{1:T}[n], y_{1:T})$ to be more and more accurate, which in turn improves the quality of the sampled $\theta$. Is this all there is to the learning process or am I missing something?

I guess for both questions, a simple 'yes' or 'no' would suffice but I would appreciate an insightful answer that can help somebody who is new to the topic have a better understanding of the concept at hand.

Second question
You're not optimizing a function here. This is Bayesian statistics, not frequentist, so you're trying to get at the posterior distribution. In your case, it's the posterior of the state process paths and the parameter vector. Yes, you can boil down that distribution into a point estimate, or an interval, but generally that's not done by optimization (unless you're doing MAP estimates)--it's done by integration. MCMC samplers draw samples to approximate this posterior distribution. Typically the samples are averaged to approximate expectations, not to estimate optima.
Ideally MCMC samplers are ergodic. This means, roughly, that if you run the sampler for long enough, taking a sample at some iteration down the line will be very close to taking a sample from the true posterior distribution. There are multiple forms of ergodicity, and some are stronger than others.
On the face of this, this isn't a great guarantee. How long until the samples get close? Also, this is a guarantee for one time point's sample. What most people want to do is to take averages of many samples, and they want guarantees that these sample averages will be close to the true theoretical expectation of the posterior. Fortunately, laws of large numbers and central limit theorems hold for chains that are ergodic in a stronger sense. This is discussed in chapter 17 of Meyn and Tweedie's book.
First question
Algorithm 4 is a Gibbs sampler, which means you alternate sampling from the conditional posteriors. In this case you alternate between sampling state paths and parameter vectors. A standard Gibbs sampler would sample from these two posterior distributions exactly.
If you use another Markov chain technique to sample parameter vectors, instead of sampling from the conditional posterior exactly, then that is complicating the algorithm. This is a strategy that's used in more simplistic Gibbs sampling (e.g. standard Metropolis-within-Gibbs), but your complicating the algorithm might void the ergodicity guarantees provided in the paper.
Even if you did verify that the sampler was still ergodic, the answer to this question would still depend on the specifics of which of these algorithms you used, and how you tuned the MH bit.
