Closed AdamMS closed 2 years ago
It works if you set the precision to a much higher value, e.g.,
Tau_prior <- jFit_CR$priors$Tau_betas_HC
largeTau <- Tau_prior %*% diag(c(1,1,1,1,1,1,1,1e10,1,1))
jFit_CR_largeTau <- jm(CoxFit_CR, list(fm1, fm2), time_var = "year",
functional_forms = CR_forms,
n_iter = 25000L, n_burnin = 5000L, n_thin = 5L,
priors = list("Tau_betas_HC" = largeTau))
Fixing the prior mean also helps:
Tau_prior <- jFit_CR$priors$Tau_betas_HC
largeTau <- Tau_prior %*% diag(c(1,1,1,1,1,1,1,1e10,1,1))
mean_betas_HC <- jFit_CR$priors$mean_betas_HC
mean_betas_HC[8L] <- 0
jFit_CR_largeTau <- jm(CoxFit_CR, list(fm1, fm2), time_var = "year",
functional_forms = CR_forms,
n_iter = 25000L, n_burnin = 5000L, n_thin = 5L,
priors = list("Tau_betas_HC" = largeTau,
"mean_betas_HC" = mean_betas_HC))
The issue resolved after I updated to the latest development version of JMbayes2 (and updated R and my packages). So, something has been fixed within the last few weeks.
Thank you in advance for considering my feedback.
I am wanting to fit a model where I restrict the prior on one of the longitudinal model betas.
[More specifically, I want to use the baseline value of the response as a predictor, but I want to use the response value itself in the association function. So, I would like the prior on the baseline covariate intercept term to be N(1, \epsilon).]
When I attempt to assign a narrow prior to one of the betas (we'll call it beta1):
I have coded up an example using the competing risks vignette, which I attach as a text file for reference. The only thing I have changed from the vignette is the prior on 'year' in the prothrombin sub-model. MWE_Priors.txt
The vignette version returns the following outputs:
But the output from my example (using the same number of MCMC samples but with no expectation of converging any time soon) are:
In general, I think I understand that the sampler is not really built for this kind of application, and that the narrow variance on the beta1 prior is causing the sampler explore the parameter space very inefficiently.
I guess the key issue that sticks with me -- and the point I want to raise to your attention is: how is it that the posterior sampling strays so far from the prior in the first place? The prior on 'year' for the prothrombin submodel has a mean of 0.244 and a variance of 0.001 (precision = 1000). It makes no sense for the MCMC sampler to be exploring values near 1741. I know from shorter runs of my example model that the 'year' parameter estimate is going astray very early in the posterior sampling (in the first 110 samples), but then the prior precision takes over and limits exploration of the parameter space for 'year'. It feels like the prior is not used for an initial cycle of 100+ samples. By the time the prior precision takes over, it is too late and the MCMC sampler in the wrong region of the parameter space.
And an important related question is: how do I ever know when a prior (even a default prior) is too specific?
Again, thank you for thinking about this. I am hopeful my feedback can help improve the MCMC sampler.