university-of-newcastle-research / pmwg

Repository for code for the Samplers Team at UoN
3 stars 3 forks source link

Scale efficient proposals as well? #81

Open gjcooper opened 3 months ago

gjcooper commented 3 months ago

Is your feature request related to a problem? Please describe. At the current defaults, the sampling stage often ends with runaway values for the subject-specific epsilon. This leads to wild particles being generated, and often NA in the weights vector for sampling from particles.

Describe the solution you'd like One solution proposed by Niek is to scale the efficient distribution as well. An additional possibility is to scale the group level distribution too.

Sample code from Niek for this is:

Those I've left unscaled. Although you could scale those as well, you would have to be careful that in the denominator the prior density is still added in its original form, something like this

  lp <- mvtnorm::dmvnorm(x = proposals, mean = mu, sigma = epsilon*sig2, log = TRUE)
  lm <- log(mix_proportion[1] * exp(lp) +
    (mix_proportion[2] * prop_density) +
    (mix_proportion[3] * eff_density))
  prior_density <- mvtnorm::dmvnorm(x = proposals, mean = mu, sigma = epsilon*sig2, log = TRUE)
  l <- lw + prior_density - lm

Describe alternatives you've considered Changing the assessment of the epsilon to only consider particles drawn from the random effects instead.