I have a tricky problem that I implemented a solution for previously in JAGS but I’m now looking to either convert that solution to Stan (if this is possible) or try an alternative model. The full background is in this paper https://doi.org/10.12688/wellcomeopenres.15849.3, under " Long-term condition prevalence and correlation models.", and our implementation is fully described on page 114-118 here https://theses.gla.ac.uk/83512/1/2022ChadwickPhD.pdf with the JAGS code here covid19_yll_final/Scripts/Extracting_comorbidity_Distributions/0201_JAGS_Model_Unidentifiable_Converged.R at master · dmcalli2/covid19_yll_final · GitHub.
Essentially, we want to understand the correlations between binary variables using only their marginal counts. The application was COVID-19, we had two summary tables of data on those who had died (individual-level data was not available). Table A gave the number of people who died with COPD, Diabetes, Heart Disease etc., Table B gave the number of people who died with 1 disease, 2 diseases, or 3+ diseases. We wanted to estimate the plausible range of correlations between the diseases given the constraints presented in the two tables. Our medic collaborators told us that a multivariate probit was an adequate way to model the latent individual-level data and the distribution of comorbidity counts (Table B) was Poisson distributed. Given the complexity of the problem, we were happy to make these assumptions!
We approaches the problem by imagining the individual level data as a binary table (Table C) filled with NAs with a row for each patient and a column for each disease. Table A gave us the column sums (number of people with each disease) and Table B gave us the row sums (the number of 1s in each row). We needed to estimate the parameters of a multivariate probit which would generate a Table C that is consistent with Tables A and B.
Can anyone suggest the best way to address this problem in Stan? In JAGS, we essentially simulate Table C from an MV Probit and do rejection sampling, plus some slightly hacky things to make things equal to each other…