Asthma: State Transitions in a Clinical Trial

An example from the BUGS book [53] concerning transitions between five clinical states in a randomized trial of treatments (seretide and fluticasone) for asthma.

Model

A discrete-time Markov model (equivalent to independent multinomial models) is fit with probability vector \bm{q}_i governing the state in the following week conditionally on the current state. Possible states are successfully treated, unsuccessfully treated, hospital-managed exacerbation, primary care-managed exacerbation, and treatment failure. The fifth state, treatment failure, is absorbing (patients cannot move out of it). The model is given by

y_{ij} &\sim \text{Multinomial}(M_i, (q_{i1}, \ldots, q_{i5})) \quad\quad i=1, \ldots, 3 \\
\bm{q}_i &\sim \text{Dirichlet}(1, \ldots, 1)

where y_{ij} is the number of transitions from state i to j

Analysis Program

using Mamba

## Data
asthma = Dict{Symbol, Any}(
  :y =>
    [210 60 0 1  1
     88 641 0 4 13
     1    0 0 0  1],
  :M =>
    [272, 746, 2]
)


## Model Specification
model = Model(

  y = Stochastic(2,
    (M, q) ->
      MultivariateDistribution[
        Multinomial(M[i], vec(q[i, :]))
        for i in 1:length(M)
      ],
    false
  ),

  q = Stochastic(2,
    M ->
      MultivariateDistribution[
        Dirichlet(ones(5))
        for i in 1:length(M)
      ],
    true
  )

)


## Initial Values
inits = [
  Dict{Symbol, Any}(
    :y => asthma[:y],
    :q => vcat([rand(Dirichlet(ones(5)))' for i in 1:3]...)
  )
  for i in 1:3
]


## Sampling Scheme
scheme = [SliceSimplex(:q)]
setsamplers!(model, scheme)


## MCMC Simulations
sim = mcmc(model, asthma, inits, 10000, burnin=2500, thin=2, chains=3)
describe(sim)

Results

Iterations = 2502:10000
Thinning interval = 2
Chains = 1,2,3
Samples per chain = 3750

Empirical Posterior Estimates:
           Mean          SD         Naive SE         MCSE          ESS
q[1,1] 0.7615754849 0.0272201055 0.000256633616 0.001595328676  291.12484
q[1,2] 0.2204851131 0.0265594084 0.000250404504 0.001578283076  283.18288
q[1,3] 0.0034735444 0.0037556875 0.000035408962 0.000069146577 2950.10543
q[1,4] 0.0072778962 0.0053705520 0.000050634050 0.000107382077 2501.34876
q[1,5] 0.0071879614 0.0053672180 0.000050602617 0.000112487762 2276.60625
q[2,1] 0.1191655126 0.0121038180 0.000114115890 0.000530342898  520.87229
q[2,2] 0.8543825941 0.0130973639 0.000123483131 0.000564705907  537.92673
q[2,3] 0.0012103544 0.0013675802 0.000012893670 0.000023654051 3342.67820
q[2,4] 0.0066582050 0.0030978699 0.000029206998 0.000059253193 2733.39774
q[2,5] 0.0185833339 0.0051526335 0.000048579495 0.000120299727 1834.54864
q[3,1] 0.2936564126 0.1740764923 0.001641208908 0.005020530045 1202.21215
q[3,2] 0.1394405572 0.1262073820 0.001189894609 0.002598964624 2358.13563
q[3,3] 0.1424463856 0.1308387051 0.001233559141 0.002834635296 2130.48310
q[3,4] 0.1417886606 0.1328770997 0.001252777310 0.003532010313 1415.32558
q[3,5] 0.2826679840 0.1709210331 0.001611458954 0.004864906134 1234.36071

Quantiles:
            2.5%          25.0%         50.0%        75.0%        97.5%
q[1,1] 0.706775811059 0.74365894715 0.7617692483 0.7804747794 0.8125428018
q[1,2] 0.169898760444 0.20150542266 0.2199140987 0.2386805795 0.2733246918
q[1,3] 0.000059528767 0.00083424954 0.0022254753 0.0048346451 0.0138405267
q[1,4] 0.000716682148 0.00327126033 0.0060441127 0.0099507177 0.0205431907
q[1,5] 0.000740554613 0.00319616653 0.0058781978 0.0098161771 0.0209389022
q[2,1] 0.096435484007 0.11060974070 0.1187015139 0.1271183450 0.1443574095
q[2,2] 0.828193845237 0.84541382625 0.8550642143 0.8634806977 0.8792757738
q[2,3] 0.000018088918 0.00028620290 0.0007503763 0.0016511135 0.0049571810
q[2,4] 0.002033379513 0.00434074296 0.0061948558 0.0084704327 0.0138428435
q[2,5] 0.010047515668 0.01486876182 0.0180566543 0.0217580995 0.0303924987
q[3,1] 0.035105559792 0.15629556479 0.2700039867 0.4070428885 0.6826474093
q[3,2] 0.002527526439 0.03939967503 0.1024828775 0.2077906692 0.4616490169
q[3,3] 0.002612503802 0.03901018402 0.1041953555 0.2089759155 0.4719934399
q[3,4] 0.002859691566 0.03827679857 0.1016367373 0.2072463302 0.4865686565
q[3,5] 0.033209396793 0.14610521565 0.2577690743 0.3965462343 0.6524841408