What is a joint model

A joint model is a statistical framework that simultaneously analyzes two or more related processes by linking them through shared underlying factors.

One of the most common applications is in healthcare research, where joint models combine:

  • Longitudinal data, such as repeated measurements of biomarkers over time; and
  • Time-to-event data, such as survival outcomes, disease progression, or treatment failure.

Rather than analyzing these outcomes separately, a joint model connects them through a shared random-effects structure, which may represent an individual’s underlying disease trajectory. This approach can reduce bias caused by informative dropout, where patients leave the study for reasons related to the outcome being measured. Joint modeling may also provide more efficient and less biased estimates of the association between changes in a longitudinal biomarker and the risk of a subsequent event.

Beyond biostatistics, joint models are also used in fields such as econometrics, engineering, and ecology whenever longitudinal measurements and event times are interrelated.

The paper “Separate and Joint Modeling of Longitudinal and Event Time Data Using Standard Computer Packages” by Xu Guo and Bradley P. Carlin (2004) is a landmark contribution to the development and practical application of joint modeling.

The paper:

  • Presented a Bayesian framework for jointly modeling longitudinal and event-time data using Markov chain Monte Carlo (MCMC) methods and demonstrated how the models could be implemented using the widely available WinBUGS software.
  • Provided a clear comparison between joint modeling and conventional separate analyses, including standard approaches implemented in software such as SAS.
  • Demonstrated the practical advantages of joint modeling using data from an AIDS clinical trial, showing how the joint analysis could produce substantially different and potentially improved estimates compared with separate analyses.

In these notes, I provide a detailed discussion of the Guo and Carlin paper together with R and WinBUGS code to reproduce the analyses, figures, and plots presented in the article.

The dataset analyzed in the paper originates from the following clinical trial:

Abrams, D. I., et al. (1994). “Comparative trial of didanosine and zalcitabine in patients with human immunodeficiency virus infection who are intolerant of or have failed zidovudine therapy.” New England Journal of Medicine, 330(10), 657–662.

Figure 1 (a), (b), (c)

We obtain the data from the R package “JMbayes2”, in fact we can run joint model using this package directly and the procedures ar much easier. However, in order to gain more controls on the models and produce close figures and tables to the paper, we will use our own R and winBUGS.

# =============================================================================
# 1. LOAD PACKAGES
# =============================================================================

library(R2WinBUGS)
library(JMbayes2)
library(dplyr)
library(coda)
library(ggplot2)
library(survival)
library(survminer)
library(nlme)



# =============================================================================
# 2. LOAD AIDS DATA
# =============================================================================

data( "aids", package = "JMbayes2")
data(  "aids.id",  package = "JMbayes2")


# =============================================================================
# 3. RECODE COVARIATES
# =============================================================================

# -----------------------------------------------------------------------------
# 3.1 Longitudinal dataset
# -----------------------------------------------------------------------------

aids.long <- aids %>%
  mutate(
    
    randgrp1 = ifelse(
      as.character(drug) == "ddI",
      1,
      0
    ),
    
    gender1 = ifelse(
      as.character(gender) == "male",
      1,
      -1
    ),
    
    prevoi1 = ifelse(
      as.character(prevOI) == "AIDS",
      1,
      -1
    ),
    
    stratum1 = ifelse(
      as.character(AZT) == "failure",
      1,
      -1
    ),
    
    event = as.integer(death)
  )


# -----------------------------------------------------------------------------
# 3.2 Subject-level survival dataset
# -----------------------------------------------------------------------------

aids.surv <- aids.id %>%
  mutate(
    
    randgrp1 = ifelse(
      as.character(drug) == "ddI",
      1,
      0
    ),
    
    gender1 = ifelse(
      as.character(gender) == "male",
      1,
      -1
    ),
    
    prevoi1 = ifelse(
      as.character(prevOI) == "AIDS",
      1,
      -1
    ),
    
    stratum1 = ifelse(
      as.character(AZT) == "failure",
      1,
      -1
    ),
    
    event = as.integer(death)
  )

Figure 1 (a)

# =============================================================================
# 4. FIGURE: CD4 DISTRIBUTION OVER TIME
# =============================================================================
#
# JMbayes2 CD4 is square-root CD4.
#
# CD4_original = CD4^2
#
# =============================================================================

#-----------------------------------------------------------------------------
# ddI
# -----------------------------------------------------------------------------

ddI <- aids.long %>%
  filter(
    drug == "ddI"
  ) %>%
  mutate(
    CD4_original = CD4^2
  )


p1 <- ggplot(
  ddI,
  aes(
    x = factor(obstime),
    y = CD4_original
  )
) +
  
  geom_boxplot(
    width = 0.45,
    fill = "grey45",
    colour = "black",
    outlier.shape = 95,
    outlier.size = 8
  ) +
  
  labs(
    x = "(a) CD4 count over time, ddI group",
    y = "CD4 count"
  ) +
  
  theme_classic() +
  
  theme(
    axis.text =
      element_text(
        colour = "black"
      ),
    
    axis.title =
      element_text(
        colour = "black"
      )
  )


print(p1)

Figure 1 (b)

# -----------------------------------------------------------------------------
# ddC
# -----------------------------------------------------------------------------

ddC <- aids.long %>%
  filter(
    drug == "ddC"
  ) %>%
  mutate(
    CD4_original = CD4^2
  )


p2 <- ggplot(
  ddC,
  aes(
    x = factor(obstime),
    y = CD4_original
  )
) +
  
  geom_boxplot(
    width = 0.45,
    fill = "grey45",
    colour = "black",
    outlier.shape = 95,
    outlier.size = 8
  ) +
  
  labs(
    x = "(b) CD4 count over time, ddC group",
    y = "CD4 count"
  ) +
  
  theme_classic() +
  
  theme(
    axis.text =
      element_text(
        colour = "black"
      ),
    
    axis.title =
      element_text(
        colour = "black"
      )
  )


print(p2)

Figure 1 (c)

# =============================================================================
#  KAPLAN-MEIER SURVIVAL CURVES
# =============================================================================
#
# IMPORTANT:
# Use aids.surv / aids.id here.
#
# Do NOT use the repeated longitudinal dataset aids.
#
# =============================================================================

aids.surv$drug <- factor(
  aids.surv$drug,
  levels = c(
    "ddI",
    "ddC"
  )
)


km.fit <- survfit(
  Surv(
    Time,
    event
  ) ~ drug,
  data = aids.surv
)


km.plot <- ggsurvplot(
  
  km.fit,
  
  data = aids.surv,
  
  pval = TRUE,
  
  conf.int = FALSE,
  
  risk.table = TRUE,
  
  risk.table.col = "strata",
  
  palette = c(
    "#E7B800",
    "#2E9FDF"
  ),
  
  xlab = "Time in months",
  
  ylab =
    "Overall survival probability",
  
  legend.title = "Drug",
  
  legend.labs = c(
    "ddI",
    "ddC"
  ),
  
  ggtheme =
    theme_classic(),
  
  tables.theme =
    theme_classic()
)


print(km.plot)

Guo and Carlin Longitudinal Model (Table 1)

The longitudinal component of the Guo and Carlin joint model describes the repeated square-root CD4 measurements for each patient over time.

The corresponding R model is:

lmeFit <- lme(

  CD4 ~
    obstime +
    obstime:randgrp1 +
    gender1 +
    prevoi1 +
    stratum1,

  random =
    ~ obstime | patient,

  data = aids.long,

  na.action = na.omit,

  control =
    lmeControl(
      opt = "optim"
    )
)

print(
  summary(
    lmeFit
  )
)
## Linear mixed-effects model fit by REML
##   Data: aids.long 
##        AIC      BIC    logLik
##   7029.733 7082.168 -3504.866
## 
## Random effects:
##  Formula: ~obstime | patient
##  Structure: General positive-definite, Log-Cholesky parametrization
##             StdDev    Corr  
## (Intercept) 4.0034864 (Intr)
## obstime     0.1734478 -0.181
## Residual    1.7487091       
## 
## Fixed effects:  CD4 ~ obstime + obstime:randgrp1 + gender1 + prevoi1 + stratum1 
##                      Value Std.Error  DF   t-value p-value
## (Intercept)       8.012447 0.3524985 936 22.730444  0.0000
## obstime          -0.166478 0.0206627 936 -8.056939  0.0000
## gender1          -0.157534 0.3263602 463 -0.482699  0.6295
## prevoi1          -2.316635 0.2393278 463 -9.679758  0.0000
## stratum1         -0.129630 0.2362663 463 -0.548659  0.5835
## obstime:randgrp1  0.029115 0.0293737 936  0.991184  0.3219
##  Correlation: 
##                  (Intr) obstim gendr1 prevo1 strtm1
## obstime          -0.103                            
## gender1          -0.759 -0.008                     
## prevoi1          -0.300  0.024 -0.008              
## stratum1          0.339 -0.007 -0.071 -0.549       
## obstime:randgrp1  0.008 -0.679 -0.007 -0.005  0.013
## 
## Standardized Within-Group Residuals:
##         Min          Q1         Med          Q3         Max 
## -4.36712902 -0.41871024 -0.06032699  0.42184168  4.36978723 
## 
## Number of Observations: 1405
## Number of Groups: 467

Mathematical form of the longitudinal model

Following the notation of Guo and Carlin, the longitudinal model can be written as

\[ Y_{ij} = \beta_{11} + \beta_{12}t_{ij} + \beta_{13}t_{ij}\text{Drug}_i + \beta_{14}\text{Gender}_i + \beta_{15}\text{PrevOI}_i + \beta_{16}\text{Stratum}_i + U_{1i} + U_{2i}t_{ij} + \epsilon_{ij}. \]

Equivalently, separating the fixed and random parts,

\[ Y_{ij} = \underbrace{ \beta_{11} + \beta_{12}t_{ij} + \beta_{13}t_{ij}\text{Drug}_i + \beta_{14}\text{Gender}_i + \beta_{15}\text{PrevOI}_i + \beta_{16}\text{Stratum}_i }_{\text{fixed-effects component}} + \underbrace{ U_{1i}+U_{2i}t_{ij} }_{\text{patient-specific random-effects component}} + \epsilon_{ij}. \]

Meaning of the indices

In

\[ Y_{ij}, \]

  • \(i\) denotes patient \(i\);
  • \(j\) denotes measurement \(j\) for that patient.

Thus, \(Y_{ij}\) is the longitudinal CD4 measurement for patient \(i\) at visit or observation \(j\).

In the Guo and Carlin analysis, the CD4 outcome is the square-root-transformed CD4 count.

In the JMbayes2 AIDS data used here, the CD4 variable is already on the square-root scale, so it should not be square-root transformed again.

3. Fixed-effects component

The fixed-effects part is

\[ \beta_{11} + \beta_{12}t_{ij} + \beta_{13}t_{ij}\text{Drug}_i + \beta_{14}\text{Gender}_i + \beta_{15}\text{PrevOI}_i + \beta_{16}\text{Stratum}_i. \]

Intercept: \(\beta_{11}\)

\[ \beta_{11} \]

is the population-level intercept.

It represents the expected CD4 level at

\[ t=0 \]

for a patient whose covariates are at their reference or zero-coded values.

Because the model does not contain a separate main effect for treatment, the two treatment groups are constrained to have the same population-level intercept at baseline.

Time effect: \(\beta_{12}\)

The term

\[ \beta_{12}t_{ij} \]

represents the longitudinal change in CD4 over time for the treatment group coded

\[ \text{Drug}_i=0. \]

Therefore,

\[ \boxed{ \beta_{12} = \text{time slope for the Drug = 0 group} } \]

in a 0/1 treatment coding scheme.

In your R code this is:

obstime

Treatment-by-time interaction: \(\beta_{13}\)

The treatment effect enters the model through

\[ \beta_{13}t_{ij}\text{Drug}_i. \]

In your R code this corresponds to:

obstime:randgrp1

This is an interaction between treatment and time.

Importantly, there is no separate treatment main-effect term such as

\[ \beta \text{Drug}_i. \]

Therefore, treatment does not directly change the intercept in this model.

Instead, treatment changes the rate of CD4 change over time.

Thus,

\[ \boxed{ \beta_{13} = \text{difference in longitudinal slopes between the two treatment groups} } \]

when treatment is coded 0/1.

Treatment-specific longitudinal trajectories

Suppose

\[ \text{Drug}_i=0. \]

Then

\[ \beta_{13}t_{ij}\text{Drug}_i=0, \]

so the longitudinal model becomes

\[ Y_{ij} = \beta_{11} + \beta_{12}t_{ij} + \beta_{14}\text{Gender}_i + \beta_{15}\text{PrevOI}_i + \beta_{16}\text{Stratum}_i + U_{1i} + U_{2i}t_{ij} + \epsilon_{ij}. \]

The population time slope is therefore

\[ \boxed{ \text{Slope}_{Drug=0}=\beta_{12} } \]

For

\[ \text{Drug}_i=1, \]

the time-related terms become

\[ \beta_{12}t_{ij}+\beta_{13}t_{ij} = (\beta_{12}+\beta_{13})t_{ij}. \]

Therefore,

\[ Y_{ij} = \beta_{11} + (\beta_{12}+\beta_{13})t_{ij} + \beta_{14}\text{Gender}_i + \beta_{15}\text{PrevOI}_i + \beta_{16}\text{Stratum}_i + U_{1i} + U_{2i}t_{ij} + \epsilon_{ij}. \]

The population time slope is

\[ \boxed{ \text{Slope}_{Drug=1} = \beta_{12}+\beta_{13} } \]

Hence,

\[ \boxed{ \beta_{13} = \text{Slope}_{Drug=1} - \text{Slope}_{Drug=0} } \]

7. Why there is no treatment main effect

Your R formula contains

obstime +
obstime:randgrp1

rather than

obstime * randgrp1

These are not equivalent.

In R,

obstime * randgrp1

automatically expands to

obstime +
randgrp1 +
obstime:randgrp1

and would therefore add a treatment main effect.

The Guo and Carlin specification represented here contains the treatment-by-time interaction but no treatment main effect.

Therefore,

obstime +
obstime:randgrp1

is the appropriate specification for this model.

The consequence is that the two treatment groups have the same modeled population-level CD4 value at

\[ t=0, \]

but they are allowed to have different slopes after baseline.

Gender effect: \(\beta_{14}\)

The term

\[ \beta_{14}\text{Gender}_i \]

represents the association between gender and the longitudinal CD4 level after adjustment for the other variables in the model.

In your R code:

gender1

corresponds to

\[ \text{Gender}_i. \]

Previous opportunistic infection: \(\beta_{15}\)

The term

\[ \beta_{15}\text{PrevOI}_i \]

represents the effect of previous opportunistic infection status on the longitudinal CD4 level.

In your R code this corresponds to:

prevoi1

AZT intolerance/failure stratum: \(\beta_{16}\)

The term

\[ \beta_{16}\text{Stratum}_i \]

represents the effect of the AZT stratum on the longitudinal CD4 outcome.

In your R code this corresponds to:

stratum1

Patient-specific random intercept

The random-effects specification in R is

random = ~ obstime | patient

This includes both a random intercept and a random slope.

The random intercept is

\[ U_{1i}. \]

It allows each patient to have a baseline CD4 level that differs from the population-average baseline level.

Therefore, the patient-specific intercept is

\[ \boxed{ \beta_{11}+U_{1i} } \]

rather than simply

\[ \beta_{11}. \]

For example:

  • \(U_{1i}>0\): patient \(i\) tends to have a higher CD4 level than the population average;
  • \(U_{1i}<0\): patient \(i\) tends to have a lower CD4 level than the population average.

Patient-specific random slope

The second random effect is

\[ U_{2i}. \]

It appears in the model as

\[ U_{2i}t_{ij}. \]

This allows each patient to have their own rate of CD4 change over time.

Thus, for a patient in the treatment group coded 0, the patient-specific time slope is

\[ \boxed{ \beta_{12}+U_{2i} } \]

and for a patient in the treatment group coded 1, the patient-specific slope is

\[ \boxed{ \beta_{12}+\beta_{13}+U_{2i} } \]

Therefore:

  • \(\beta_{12}\) describes the population-average time trend for Drug = 0;
  • \(\beta_{13}\) describes the treatment difference in the population-average time trend;
  • \(U_{2i}\) describes how patient \(i\)’s individual time trend differs from the population-average trend.

Random-effects distribution

The random intercept and random slope can be written as

\[ \mathbf{U}_i = \begin{pmatrix} U_{1i}\\ U_{2i} \end{pmatrix}. \]

They are assumed to follow a bivariate normal distribution,

\[ \begin{pmatrix} U_{1i}\\ U_{2i} \end{pmatrix} \sim N \left[ \begin{pmatrix} 0\\ 0 \end{pmatrix}, \begin{pmatrix} \sigma_{U_1}^{2} & \sigma_{U_1U_2}\\ \sigma_{U_1U_2} & \sigma_{U_2}^{2} \end{pmatrix} \right]. \]

Here,

\[ \sigma_{U_1}^{2} = \mathrm{Var}(U_{1i}) \]

is the between-patient variance in intercepts,

\[ \sigma_{U_2}^{2} = \mathrm{Var}(U_{2i}) \]

is the between-patient variance in slopes, and

\[ \sigma_{U_1U_2} = \mathrm{Cov}(U_{1i},U_{2i}) \]

describes the association between a patient’s baseline CD4 level and their subsequent CD4 trajectory.

For example, a negative covariance would indicate that patients with higher-than-average baseline CD4 levels tend to have more negative slopes, although the actual interpretation depends on the estimated covariance.

Residual error

The residual error is

\[ \epsilon_{ij}. \]

It represents variation in the observed CD4 measurement that is not explained by either:

  1. the fixed effects, or
  2. the patient-specific random effects.

Typically,

\[ \epsilon_{ij} \sim N(0,\sigma_{\epsilon}^{2}). \]

Thus,

\[ \sigma_{\epsilon}^{2} \]

represents the within-patient residual variance.

Population-average versus patient-specific trajectory

The population-average longitudinal trajectory is

\[ \mu_{ij}^{\text{population}} = \beta_{11} + \beta_{12}t_{ij} + \beta_{13}t_{ij}\text{Drug}_i + \beta_{14}\text{Gender}_i + \beta_{15}\text{PrevOI}_i + \beta_{16}\text{Stratum}_i. \]

The patient-specific underlying trajectory is

\[ \mu_i(t) = \beta_{11} + \beta_{12}t + \beta_{13}t\text{Drug}_i + \beta_{14}\text{Gender}_i + \beta_{15}\text{PrevOI}_i + \beta_{16}\text{Stratum}_i + U_{1i} + U_{2i}t. \]

The observed measurement is then

\[ Y_{ij} = \mu_i(t_{ij}) + \epsilon_{ij}. \]

This distinction becomes particularly important in a joint longitudinal-survival model because the survival component can be linked to the patient’s latent longitudinal process or to the shared random effects.

Mapping the mathematical model to the R code

Mathematical term Interpretation R code
\(Y_{ij}\) Square-root CD4 measurement CD4
\(t_{ij}\) Observation time obstime
\(\beta_{11}\) Fixed intercept Automatically included
\(\beta_{12}t_{ij}\) Main effect of time obstime
\(\beta_{13}t_{ij}Drug_i\) Treatment-by-time interaction obstime:randgrp1
\(\beta_{14}Gender_i\) Gender effect gender1
\(\beta_{15}PrevOI_i\) Previous OI effect prevoi1
\(\beta_{16}Stratum_i\) AZT stratum effect stratum1
\(U_{1i}\) Patient-specific random intercept 1 | patient
\(U_{2i}t_{ij}\) Patient-specific random slope obstime | patient
\(\epsilon_{ij}\) Residual error Residual component of lme()

17. Compact interpretation

The Guo and Carlin longitudinal model can be summarized as

\[ \boxed{ \text{CD4} = \text{population trajectory} + \text{patient-specific deviation} + \text{measurement error} } \]

More explicitly,

\[ \boxed{ Y_{ij} = \beta_{11} + \beta_{12}t_{ij} + \beta_{13}t_{ij}Drug_i + \beta_{14}Gender_i + \beta_{15}PrevOI_i + \beta_{16}Stratum_i + U_{1i} + U_{2i}t_{ij} + \epsilon_{ij} } \]

The two key patient-specific random effects are:

\[ \boxed{ U_{1i}=\text{random intercept} } \]

and

\[ \boxed{ U_{2i}=\text{random slope for time}. } \]

Therefore, random = ~ obstime | patient means that each patient is allowed to have both:

  1. their own baseline CD4 level; and
  2. their own rate of CD4 change over time.

The treatment effect in this longitudinal model is represented through the treatment-by-time interaction. It therefore modifies the CD4 trajectory over time rather than adding a separate baseline treatment difference.

Separate survival models (Table 1)

These classical survival modes are much easier.

# =============================================================================
# PRELIMINARY EXPONENTIAL SURVIVAL MODEL
# =============================================================================

exp.fit <- survreg(
  
  Surv(
    Time,
    event
  ) ~
    
    randgrp1 +
    
    gender1 +
    
    prevoi1 +
    
    stratum1,
  
  data = aids.surv,
  
  dist = "exponential"
)


print(
  summary(
    exp.fit
  )
)
## 
## Call:
## survreg(formula = Surv(Time, event) ~ randgrp1 + gender1 + prevoi1 + 
##     stratum1, data = aids.surv, dist = "exponential")
##               Value Std. Error     z       p
## (Intercept)  3.7020     0.1619 22.87 < 2e-16
## randgrp1    -0.2080     0.1464 -1.42    0.16
## gender1      0.1694     0.1226  1.38    0.17
## prevoi1     -0.6195     0.1132 -5.47 4.4e-08
## stratum1    -0.0824     0.0815 -1.01    0.31
## 
## Scale fixed at 1 
## 
## Exponential distribution
## Loglik(model)= -806.3   Loglik(intercept only)= -835.9
##  Chisq= 59.14 on 4 degrees of freedom, p= 4.4e-12 
## Number of Newton-Raphson Iterations: 5 
## n= 467
# =============================================================================
# PRELIMINARY COX MODEL
# =============================================================================

cox.fit <- coxph(
  
  Surv(
    Time,
    event
  ) ~
    
    randgrp1 +
    
    gender1 +
    
    prevoi1 +
    
    stratum1,
  
  data = aids.surv
)

print(
  summary(
    cox.fit
  )
)
## Call:
## survival::coxph(formula = Surv(Time, event) ~ randgrp1 + gender1 + 
##     prevoi1 + stratum1, data = aids.surv)
## 
##   n= 467, number of events= 188 
## 
##              coef exp(coef) se(coef)      z Pr(>|z|)    
## randgrp1  0.21700   1.24234  0.14644  1.482    0.138    
## gender1  -0.17094   0.84287  0.12273 -1.393    0.164    
## prevoi1   0.64602   1.90792  0.11349  5.692 1.25e-08 ***
## stratum1  0.07873   1.08191  0.08171  0.964    0.335    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
##          exp(coef) exp(-coef) lower .95 upper .95
## randgrp1    1.2423     0.8049    0.9324     1.655
## gender1     0.8429     1.1864    0.6627     1.072
## prevoi1     1.9079     0.5241    1.5274     2.383
## stratum1    1.0819     0.9243    0.9218     1.270
## 
## Concordance= 0.646  (se = 0.02 )
## Likelihood ratio test= 63.52  on 4 df,   p=5e-13
## Wald test            = 48.88  on 4 df,   p=6e-10
## Score (logrank) test = 56.28  on 4 df,   p=2e-11

Summary of Joint model method

Section 2 of Guo and Carlin (2004) reviews the classical statistical models used for longitudinal and survival data and then describes how these two processes can be linked in a joint model.

Suppose there are \(m\) subjects followed over time. For subject \(i\):

  • \(y_{ij}\) is the \(j\)th longitudinal measurement, observed at time \(s_{ij}\), for \(j = 1,\ldots,n_i\);
  • \(t_i\) is the observed survival or event time, which may be right-censored.

The main idea is that longitudinal and survival outcomes can first be modeled separately, but they may be statistically dependent because they are influenced by the same underlying subject-specific health status. The joint model therefore connects the two processes through shared latent random effects.

2.1 Longitudinal Data Model

Guo and Carlin use a linear mixed-effects model for the repeated continuous measurements.

The general model is

\[ y_{ij} = \mu_i(s_{ij}) + W_{1i}(s_{ij}) + \epsilon_{ij}, \]

where

\[ \mu_i(s) = \mathbf{x}_{1i}(s)^T\boldsymbol{\beta}_1 \]

is the population-average or fixed-effects component, and

\[ W_{1i}(s) = \mathbf{d}_{1i}(s)^T\mathbf{U}_i \]

is the subject-specific random-effects component.

The measurement errors are assumed to be independent normal random variables:

\[ \epsilon_{ij} \sim N(0,\sigma_\epsilon^2). \]

The random-effects vector is typically assumed to follow a multivariate normal distribution,

\[ \mathbf{U}_i \sim N(\mathbf{0},\Sigma). \]

Therefore, the longitudinal model separates each observed measurement into three components:

\[ \text{Observed longitudinal outcome} = \text{fixed effects} + \text{subject-specific random effects} + \text{measurement error}. \]

The fixed effects describe the average longitudinal trajectory in the population, whereas the random effects allow individual subjects to have trajectories that differ from the population average.

In the application considered by Guo and Carlin, the random-effects process is later written as

\[ W_{1i}(s) = U_{1i} + U_{2i}s, \]

where:

  • \(U_{1i}\) is a subject-specific random intercept;
  • \(U_{2i}\) is a subject-specific random slope.

Thus, different patients may have different baseline CD4 levels and different rates of change in CD4 over time.

2.2 Survival Data Models

Guo and Carlin discuss both parametric and semiparametric survival models.

The survival model includes observed covariates and may also contain a subject-specific latent process \(W_{2i}(t)\).

2.2.1 Weibull Model

For a Weibull model, the survival time for subject \(i\) is assumed to follow a Weibull distribution.

The linear predictor is written as

\[ \log\{\lambda_i(t)\} = \mathbf{x}_{2i}(t)^T\boldsymbol{\beta}_2 + W_{2i}(t), \]

where:

  • \(\mathbf{x}_{2i}(t)\) contains observed explanatory variables;
  • \(\boldsymbol{\beta}_2\) contains their regression coefficients;
  • \(W_{2i}(t)\) represents subject-specific latent effects in the survival process.

Using the WinBUGS parameterization described in the paper, the hazard is

\[ h_i(t) = r t^{r-1} \exp \left\{ \mathbf{x}_{2i}(t)^T\boldsymbol{\beta}_2 + W_{2i}(t) \right\}, \]

where \(r>0\) is the Weibull shape parameter.

The interpretation of \(r\) is:

\[ r < 1 \quad \Rightarrow \quad \text{hazard decreases over time}, \]

\[ r = 1 \quad \Rightarrow \quad \text{constant hazard}, \]

and

\[ r > 1 \quad \Rightarrow \quad \text{hazard increases over time}. \]

When

\[ r=1, \]

the Weibull model reduces to an exponential survival model.

2.2.2 Cox Proportional Hazards Model

The Cox proportional hazards model replaces the parametric Weibull baseline hazard with an unspecified baseline hazard:

\[ h_i(t) = h_0(t) \exp \left\{ \mathbf{x}_{2i}(t)^T\boldsymbol{\beta}_2 + W_{2i}(t) \right\}. \]

Here,

\[ h_0(t) \]

is an arbitrary baseline hazard function.

The advantage of the Cox model is that the baseline hazard does not need to follow a particular parametric distribution. However, the model still assumes proportional hazards with respect to the covariate effects.

2.3 Joint Longitudinal-Survival Model

The key methodological contribution discussed in Section 2 is the joint modeling framework of Henderson, Diggle, and Dobson.

The longitudinal and survival processes may be related in two ways:

  1. They may contain some of the same observed explanatory variables.
  2. They may be stochastically dependent through shared latent subject-specific effects.

Guo and Carlin focus particularly on the second form of association.

The model assumes that the longitudinal and survival outcomes are conditionally independent once the observed covariates and latent random-effects processes are known.

In other words,

\[ \text{Longitudinal outcome} \perp \text{Survival outcome} \mid \text{covariates and latent random effects}. \]

Marginally, however, the two outcomes are dependent because they share common latent subject-specific characteristics.

Longitudinal random-effects process

The paper specifies

\[ W_{1i}(s) = U_{1i} + U_{2i}s. \]

This is a random-intercept and random-slope model.

The two random effects are assumed to follow a bivariate normal distribution:

\[ \begin{pmatrix} U_{1i}\\ U_{2i} \end{pmatrix} \sim N \left[ \begin{pmatrix} 0\\ 0 \end{pmatrix}, \Sigma \right]. \]

The covariance matrix can be written as

\[ \Sigma = \begin{pmatrix} \sigma_{11} & \sigma_{12}\\ \sigma_{12} & \sigma_{22} \end{pmatrix}. \]

Here:

  • \(\sigma_{11}\) is the variance of the random intercept;
  • \(\sigma_{22}\) is the variance of the random slope;
  • \(\sigma_{12}\) is the covariance between random intercept and random slope.

Survival latent process

Guo and Carlin write the survival latent process as

\[ W_{2i}(t) = \gamma_1 U_{1i} + \gamma_2 U_{2i} + \gamma_3 \left( U_{1i} + U_{2i}t \right) + U_{3i}. \]

Since

\[ W_{1i}(t) = U_{1i}+U_{2i}t, \]

this can also be written as

\[ W_{2i}(t) = \gamma_1U_{1i} + \gamma_2U_{2i} + \gamma_3W_{1i}(t) + U_{3i}. \]

This equation shows the different mechanisms by which the longitudinal process may be associated with survival.

Association through the random intercept

\[ \gamma_1U_{1i} \]

links survival with the subject’s underlying baseline longitudinal level.

For the CD4 application, \(U_{1i}\) represents whether a patient’s underlying CD4 level is higher or lower than expected after adjustment for the fixed effects.

Thus, \(\gamma_1\) measures whether this subject-specific baseline CD4 level is associated with mortality risk.

Association through the random slope

\[ \gamma_2U_{2i} \]

links survival with the subject-specific rate of longitudinal change.

For the CD4 application, \(U_{2i}\) represents whether a patient’s CD4 count declines more slowly or more rapidly than the population-average trajectory.

Thus, \(\gamma_2\) measures the association between the individual CD4 slope and the hazard of death.

Association through the current fitted longitudinal value

\[ \gamma_3W_{1i}(t) = \gamma_3(U_{1i}+U_{2i}t) \]

allows the hazard of death at time \(t\) to depend on the patient’s current underlying longitudinal value at the same time.

This creates a time-varying association between the longitudinal marker and the survival process.

Additional survival frailty

\[ U_{3i} \]

is an additional subject-specific frailty term.

It is assumed to follow

\[ U_{3i} \sim N(0,\sigma_3^2) \]

and to be independent of \(U_{1i}\) and \(U_{2i}\).

The purpose of \(U_{3i}\) is to capture residual subject-to-subject heterogeneity in survival that is not explained by the observed covariates or by the shared longitudinal random effects.

In survival analysis, a frailty term \(U_i\) captures the fact that two patients with exactly the same measured covariates may still have different risks because of unmeasured factors.

For the survival model,

\[\log(\lambda_i) = X_i \beta + U_{3i},\]

so \(U_{3i}\) changes patient \(i\)’s hazard:

\[\lambda_i = \exp(X_i \beta) \exp(U_{3i}).\]

A patient with a larger positive \(U_{3i}\) has a larger hazard and is therefore, statistically speaking, more “frail” or susceptible to the event.

For example:

\(U_{3i} = 0.5\) gives \(\exp(0.5) = 1.65\), so that patient has about 1.65 times the hazard of an otherwise identical patient with \(U_3 = 0\).

Conversely, \(U_{3i} = -0.5\) gives a hazard multiplier of about 0.61, meaning lower underlying susceptibility.

The word frailty does not necessarily mean physical frailty in the clinical sense. It means unobserved heterogeneity in event risk.

So in the survival model, \(U_3\) can be understood as:

a patient-specific latent risk factor that makes some patients more or less prone to death than their observed covariates would predict.

That is why it is called a frailty term rather than just a random intercept, even though mathematically it behaves like a random intercept on the log-hazard scale.

Interpretation of the Joint Model

The important feature of the joint model is that the same latent random effects that describe an individual’s longitudinal trajectory also enter the survival model.

For example,

\[ U_{1i} \]

appears in the longitudinal model and may also enter the survival model through

\[ \gamma_1U_{1i}. \]

Similarly,

\[ U_{2i} \]

determines the patient’s individual longitudinal slope and may affect the hazard through

\[ \gamma_2U_{2i}. \]

Therefore, repeated longitudinal measurements provide information about the latent random effects, and these random effects in turn provide information about the patient’s survival risk.

This is the fundamental mechanism by which the joint model “borrows information” between the longitudinal and survival processes.

Why Joint Modeling Is Important

If the longitudinal marker is related to a patient’s underlying health status, subjects with poorer health may die or drop out earlier.

Consequently, missing longitudinal measurements may not be independent of the longitudinal outcome itself.

Analyzing the longitudinal process alone may therefore produce biased or inefficient estimates because subjects with worse trajectories may disappear from follow-up earlier.

Joint modeling addresses this problem by explicitly modeling the dependence between the longitudinal trajectory and the event process.

Guo and Carlin state that, when such an association exists, joint modeling should generally provide less biased and more efficient inference than separate analyses.

Summary of Section 2

The methodological structure of Section 2 can be summarized as

\[ \boxed{ \text{Longitudinal model} + \text{Survival model} + \text{shared latent random effects} = \text{Joint model} } \]

The longitudinal component is

\[ y_{ij} = \mathbf{x}_{1i}(s_{ij})^T\boldsymbol{\beta}_1 + U_{1i} + U_{2i}s_{ij} + \epsilon_{ij}. \]

The survival component can be written generally as

\[ h_i(t) = h_0(t) \exp \left\{ \mathbf{x}_{2i}(t)^T\boldsymbol{\beta}_2 + W_{2i}(t) \right\}, \]

where

\[ W_{2i}(t) = \gamma_1U_{1i} + \gamma_2U_{2i} + \gamma_3(U_{1i}+U_{2i}t) + U_{3i}. \]

Therefore:

\[ \gamma_1 \]

measures association through the subject-specific longitudinal intercept,

\[ \gamma_2 \]

measures association through the subject-specific longitudinal slope,

\[ \gamma_3 \]

measures association through the current underlying longitudinal value, and

\[ U_{3i} \]

represents additional survival heterogeneity or frailty.

The central assumption is conditional independence:

\[ \boxed{ Y_i \perp T_i \mid U_{1i},U_{2i},U_{3i},\text{covariates} } \]

but because the two outcomes share latent variables, they remain dependent marginally.

This shared-random-effects structure is the central idea underlying the joint longitudinal-survival models examined by Guo and Carlin.

WinBUGS implementation for MODELS XI AND XII

In Guo and Carlin (2004), Models XI and XII use the same longitudinal submodel. The main difference is how the subject-specific longitudinal random effects enter the survival submodel.

The longitudinal model describes each patient’s repeated CD4 trajectory, while the survival model describes the hazard of death.

The two processes are linked through shared latent random effects.

Common Longitudinal Model

For both Models XI and XII, the longitudinal model can be written as

\[ y_{ij} = \beta_{11} + \beta_{12}s_{ij} + \beta_{13}s_{ij}Drug_i + \beta_{14}Gender_i + \beta_{15}PrevOI_i + \beta_{16}Stratum_i + U_{1i} + U_{2i}s_{ij} + \epsilon_{ij}. \]

The subject-specific longitudinal component is

\[ W_{1i}(s) = U_{1i} + U_{2i}s. \]

Here,

\[ U_{1i} \]

is the subject-specific random intercept, and

\[ U_{2i} \]

is the subject-specific random slope.

The random intercept represents whether a patient’s underlying CD4 level is higher or lower than would be expected from the fixed effects.

The random slope represents whether the patient’s CD4 trajectory declines faster or slower than the population-average trajectory.

The two random effects are usually modeled jointly as

\[ \begin{pmatrix} U_{1i}\\ U_{2i} \end{pmatrix} \sim N \left[ \begin{pmatrix} 0\\ 0 \end{pmatrix}, \Sigma \right]. \]

Therefore, the random intercept and random slope may also be correlated.

Model XI

For Model XI, Guo and Carlin specify the survival latent process as

\[ W_{2i} = \gamma_1U_{1i} + \gamma_2U_{2i}. \]

Thus, the survival model can be written as

\[ \log(\lambda_i) = \beta_{21} + \beta_{22}Drug_i + \beta_{23}Gender_i + \beta_{24}PrevOI_i + \beta_{25}Stratum_i + \gamma_1U_{1i} + \gamma_2U_{2i}. \]

Because Guo and Carlin used an exponential model in their final analyses,

\[ \lambda_i = \exp \left[ X_i^T\beta_2 + \gamma_1U_{1i} + \gamma_2U_{2i} \right]. \]

Meaning of \(\gamma_1U_{1i}\)

The term

\[ \gamma_1U_{1i} \]

links survival to the patient’s subject-specific CD4 level.

The parameter

\[ \gamma_1 \]

measures the association between the random intercept and the hazard of death.

For example, suppose

\[ \gamma_1<0. \]

If a patient has

\[ U_{1i}>0, \]

then the patient has an underlying CD4 level above the population prediction.

Because

\[ \gamma_1U_{1i}<0, \]

this lowers the log-hazard and therefore lowers the hazard of death.

This is clinically sensible:

\[ \text{higher underlying CD4 level} \rightarrow \text{lower mortality risk}. \]

Meaning of \(\gamma_2U_{2i}\)

The term

\[ \gamma_2U_{2i} \]

links survival to the patient’s subject-specific CD4 slope.

The random slope

\[ U_{2i} \]

indicates whether the patient’s CD4 trajectory changes more favorably or less favorably than the population-average trajectory.

Suppose

\[ \gamma_2<0. \]

A patient with a more positive \(U_{2i}\) has a better CD4 trajectory, meaning that the CD4 count declines less rapidly than average, or may even increase relative to the average trajectory.

Then

\[ \gamma_2U_{2i}<0, \]

which decreases the mortality hazard.

Thus, Model XI says that survival depends on two characteristics of the longitudinal CD4 trajectory:

\[ \boxed{ \text{subject-specific underlying CD4 level} } \]

and

\[ \boxed{ \text{subject-specific rate of CD4 change} } \]

or, more simply,

\[ \boxed{ \text{Model XI = baseline level + rate of change} } \]

Model XII

Model XII contains everything in Model XI, but adds another association term.

Guo and Carlin specify

\[ W_{2i}(t) = \gamma_1U_{1i} + \gamma_2U_{2i} + \gamma_3(U_{1i}+U_{2i}t). \]

Since

\[ W_{1i}(t) = U_{1i}+U_{2i}t, \]

Model XII can also be written as

\[ W_{2i}(t) = \gamma_1U_{1i} + \gamma_2U_{2i} + \gamma_3W_{1i}(t). \]

Therefore, the survival model becomes

\[ \log(\lambda_i(t)) = X_i^T\beta_2 + \gamma_1U_{1i} + \gamma_2U_{2i} + \gamma_3W_{1i}(t). \]

The additional term in Model XII is

\[ \boxed{ \gamma_3W_{1i}(t) } \]

or equivalently,

\[ \boxed{ \gamma_3(U_{1i}+U_{2i}t) } \]

Meaning of \(W_{1i}(t)\)

The quantity

\[ W_{1i}(t) = U_{1i} + U_{2i}t \]

is the patient-specific longitudinal deviation at time \(t\).

It is important to note that this is not the complete predicted CD4 value.

The complete predicted longitudinal value is

\[ \mu_i(t) = X_{1i}(t)^T\beta_1 + U_{1i} + U_{2i}t. \]

Therefore,

\[ W_{1i}(t) \]

is specifically the patient’s deviation from the fixed-effects population trajectory.

For example, at time

\[ t=10, \]

the patient-specific longitudinal deviation is

\[ W_{1i}(10) = U_{1i} + 10U_{2i}. \]

This combines the patient’s baseline deviation and slope deviation into one time-specific quantity.

Meaning of \(\gamma_3\)

The parameter

\[ \gamma_3 \]

measures whether the patient’s current underlying longitudinal status is associated with the hazard of death.

Thus, Model XII asks an additional question:

\[ \boxed{ \text{Does the patient's mortality risk at time } t \text{ depend on where the patient's CD4 trajectory currently lies?} } \]

This is different from Model XI.

Model XI uses the random intercept and random slope as two separate characteristics of the patient.

Model XII additionally allows the current value of the random-effects trajectory to influence survival.

Therefore,

\[ \boxed{ \text{Model XII = baseline level + rate of change + current longitudinal status} } \]

Key Difference Between Models XI and XII

Model XI is

\[ \boxed{ W_{2i} = \gamma_1U_{1i} + \gamma_2U_{2i} } \]

whereas Model XII is

\[ \boxed{ W_{2i}(t) = \gamma_1U_{1i} + \gamma_2U_{2i} + \gamma_3(U_{1i}+U_{2i}t) } \]

The main difference is that Model XII includes a time-varying association through

\[ \gamma_3W_{1i}(t). \]

A useful comparison is:

Feature Model XI Model XII
Random intercept \(U_{1i}\) Yes Yes
Random slope \(U_{2i}\) Yes Yes
Current longitudinal deviation \(W_{1i}(t)\) No Yes
Time-varying association through \(W_{1i}(t)\) No Yes
Association parameters \(\gamma_1,\gamma_2\) \(\gamma_1,\gamma_2,\gamma_3\)

Why Model XII Is More Complicated

The additional term in Model XII can be expanded as

\[ W_{2i}(t) = \gamma_1U_{1i} + \gamma_2U_{2i} + \gamma_3U_{1i} + \gamma_3U_{2i}t. \]

Rearranging,

\[ W_{2i}(t) = (\gamma_1+\gamma_3)U_{1i} + (\gamma_2+\gamma_3t)U_{2i}. \]

This expression is very informative.

For the random intercept, the effective coefficient becomes

\[ \gamma_1+\gamma_3. \]

For the random slope, the effective coefficient becomes

\[ \gamma_2+\gamma_3t. \]

Therefore, the effect of the random slope on survival is allowed to change with time.

In Model XI, the contribution of the random slope is simply

\[ \gamma_2U_{2i}, \]

so its association with survival is time-constant.

In Model XII, however, its contribution includes

\[ \gamma_3U_{2i}t, \]

which makes the association time-dependent.

Therefore:

\[ \boxed{ \text{Model XI has a time-constant association structure} } \]

whereas

\[ \boxed{ \text{Model XII introduces a time-dependent association structure} } \]

Simple Clinical Interpretation

A useful way to distinguish the two models is to think about the questions they ask.

Model XI

Model XI asks:

Question 1

Does survival depend on whether the patient’s underlying CD4 level is higher or lower than expected?

This is represented by

\[ \gamma_1U_{1i}. \]

Question 2

Does survival depend on whether the patient’s CD4 count is declining faster or slower than expected?

This is represented by

\[ \gamma_2U_{2i}. \]

Thus,

\[ \boxed{ \text{Model XI = underlying level + trajectory slope} } \]

Model XII

Model XII asks both of the above questions, but also asks:

Question 3

At a particular time \(t\), does the patient’s mortality risk depend on the patient’s current underlying CD4 position?

This is represented by

\[ \gamma_3W_{1i}(t). \]

Thus,

\[ \boxed{ \text{Model XII = underlying level + trajectory slope + current longitudinal position} } \]

Why Guo and Carlin Preferred Model XI

In the original paper, Guo and Carlin compared the candidate joint models using the Deviance Information Criterion, or DIC.

They reported

\[ DIC_{XI} = 7548.3 \]

and

\[ DIC_{XII} = 7625.2. \]

Because a smaller DIC indicates a preferred model, Model XI performed better according to their reported analysis.

They also reported that the 95% posterior credible interval for

\[ \gamma_3 \]

in Model XII was approximately

\[ (-0.43,\ 0.26), \]

which included zero.

Therefore, their data did not provide strong evidence that the additional current-value association

\[ \gamma_3W_{1i}(t) \]

was necessary.

The authors therefore selected Model XI as their final preferred model.

Their interpretation was that patient survival was mainly associated with two important features of the longitudinal CD4 trajectory:

\[ \boxed{ \text{initial underlying CD4 level} } \]

and

\[ \boxed{ \text{rate of CD4 decline} } \]

rather than requiring an additional time-varying current-value association.

Important Point for Replication

The definitions of Models XI and XII do not depend on which model gives the lower DIC in a particular replication.

Model XI is always defined as

\[ W_{2i} = \gamma_1U_{1i} + \gamma_2U_{2i}, \]

and Model XII is always defined as

\[ W_{2i}(t) = \gamma_1U_{1i} + \gamma_2U_{2i} + \gamma_3W_{1i}(t). \]

If a replication produces a lower DIC for Model XII than for Model XI, that does not change the model definitions.

It simply means that, under that particular implementation, prior specification, MCMC sample, data processing, or likelihood construction, the additional current-value association in Model XII is receiving more support than it did in the original paper.

Final Summary

The distinction between Models XI and XII can be summarized as

\[ \boxed{ \text{Model XI: } \gamma_1U_{1i} + \gamma_2U_{2i} } \]

versus

\[ \boxed{ \text{Model XII: } \gamma_1U_{1i} + \gamma_2U_{2i} + \gamma_3(U_{1i}+U_{2i}t) } \]

Model XI links mortality risk to the patient’s subject-specific CD4 level and slope.

Model XII additionally allows mortality risk to depend on the patient’s current subject-specific longitudinal position at time \(t\).

Therefore, the conceptual progression is

\[ \boxed{ \text{Model XI} = \text{level + slope} } \]

and

\[ \boxed{ \text{Model XII} = \text{level + slope + time-varying current longitudinal status}. } \]

R code for implement model XI, XII

# =============================================================================
# GUO & CARLIN (2004)
# MODELS XI AND XII
#
# R2WinBUGS implementation reproducing the ORIGINAL WEBSITE WinBUGS programs
#
# Dataset: JMbayes2::aids and JMbayes2::aids.id
#
# Model XI:
#   W2_i = r1 * U1_i + r2 * U2_i
#
# Model XII:
#   W2_i(t) = r1 * U1_i + r2 * U2_i
#             + r3 * (U1_i + U2_i * t)
#
# IMPORTANT:
# Priors match the Guo-Carlin WinBUGS programs:
#
#   Sigma1 = diag(0.01, 6)    precision matrix
#   Sigma2 = diag(0.01, 5)    precision matrix
#   R      = diag(100, 2)
#   tau ~ Wishart(R, 23)
#   tauz ~ Gamma(0.1, 0.1)
#   r ~ Normal(0, precision = 0.01)
#
# =============================================================================


# =============================================================================
# 1. USER SETTINGS
# =============================================================================

working.directory <- "D:/Joint_model/winBUGS"
bugs.directory <- "D:/WinBUGS14/"

setwd(working.directory)

# =============================================================================
# 2. LOAD DATA
# =============================================================================

data("aids", package = "JMbayes2")
data("aids.id", package = "JMbayes2")


cat("\nNumber of longitudinal rows:", nrow(aids), "\n")
## 
## Number of longitudinal rows: 1405
cat("Number of subjects:", nrow(aids.id), "\n")
## Number of subjects: 467
# Guo-Carlin dataset should contain 467 subjects

stopifnot(nrow(aids.id) == 467)


# =============================================================================
# 3. RECODE BASELINE COVARIATES
# =============================================================================
#
# Coding used by Guo & Carlin:
#
# drug:
#   ddI = 1
#   ddC = 0
#
# gender:
#   male   =  1
#   female = -1
#
# previous opportunistic infection:
#   AIDS    =  1
#   noAIDS  = -1
#
# AZT stratum:
#   failure     =  1
#   intolerance = -1
#
# =============================================================================


aids.id2 <- aids.id %>%
  mutate(
    
    randgrp1 = ifelse(
      as.character(drug) == "ddI",
      1,
      0
    ),
    
    gender1 = ifelse(
      as.character(gender) == "male",
      1,
      -1
    ),
    
    prevoi1 = ifelse(
      as.character(prevOI) == "AIDS",
      1,
      -1
    ),
    
    stratum1 = ifelse(
      as.character(AZT) == "failure",
      1,
      -1
    ),
    
    event = as.integer(death)
  )


print(table(aids.id2$drug, aids.id2$randgrp1))
##      
##         0   1
##   ddC 237   0
##   ddI   0 230
print(table(aids.id2$gender, aids.id2$gender1))
##         
##           -1   1
##   female  45   0
##   male     0 422
print(table(aids.id2$prevOI, aids.id2$prevoi1))
##         
##           -1   1
##   noAIDS 160   0
##   AIDS     0 307
print(table(aids.id2$AZT, aids.id2$stratum1))
##              
##                -1   1
##   intolerance 292   0
##   failure       0 175
print(table(aids.id2$event))
## 
##   0   1 
## 279 188
# =============================================================================
# 4. CREATE ORIGINAL 467 x 5 LONGITUDINAL MATRIX
# =============================================================================
#
# The original WinBUGS program uses:
#
#     N = 467
#     M = 5
#     t = c(0, 2, 6, 12, 18)
#
# rather than the long-format model we used previously.
#
# =============================================================================


visit.times <- c(0, 2, 6, 12, 18)

N <- nrow(aids.id2)
M <- length(visit.times)

stopifnot(N == 467)
stopifnot(M == 5)


# -------------------------------------------------------------------------
# Identify subject order
# -------------------------------------------------------------------------

subject.ids <- aids.id2$patient


# Empty matrix
Y <- matrix(
  NA_real_,
  nrow = N,
  ncol = M
)


# -------------------------------------------------------------------------
# Put CD4 observations into their correct scheduled visit columns
# -------------------------------------------------------------------------

for (i in seq_len(N)) {
  
  subject.data <- aids[
    aids$patient == subject.ids[i],
    ,
    drop = FALSE
  ]
  
  for (j in seq_len(M)) {
    
    tmp <- subject.data$CD4[
      subject.data$obstime == visit.times[j]
    ]
    
    if (length(tmp) == 1L) {
      
      Y[i, j] <- as.numeric(tmp)
      
    } else if (length(tmp) > 1L) {
      
      stop(
        "More than one CD4 measurement for patient ",
        subject.ids[i],
        " at time ",
        visit.times[j]
      )
    }
  }
}

# =============================================================================
# 6. SURVIVAL DATA
# =============================================================================

followup.time <- as.numeric(aids.id2$Time)

event <- as.integer(aids.id2$event)


if (!all(event %in% c(0L, 1L))) {
  stop("death/event must be coded 0/1.")
}

if (anyNA(followup.time)) {
  stop("Missing follow-up times.")
}

if (any(followup.time <= 0)) {
  stop("Follow-up times must be > 0.")
}


# -------------------------------------------------------------------------
# WinBUGS censoring representation
#
# Death:
#      surt = observed death time
#      surt.cen = 0
#
# Censored:
#      surt = NA
#      surt.cen = censoring time
#
# -------------------------------------------------------------------------

surt <- ifelse(
  event == 1L,
  followup.time,
  NA_real_
)

surt.cen <- ifelse(
  event == 0L,
  followup.time,
  0
)


# Model XII code uses tee = observed follow-up time
tee <- followup.time


# =============================================================================
# 7. PRIORS -- EXACTLY MATCH WEBSITE CODE
# =============================================================================

betamu1 <- rep(0, 6)

betamu2 <- rep(0, 5)


# IMPORTANT:
# dmnorm() second argument = PRECISION matrix.
#
# Original website:
# diagonal = 0.01
#
# Therefore marginal prior variance = 100.

Sigma1 <- diag(
  0.01,
  nrow = 6,
  ncol = 6
)

Sigma2 <- diag(
  0.01,
  nrow = 5,
  ncol = 5
)


# IMPORTANT:
# Original Guo-Carlin code uses R = diag(100, 2)

R <- diag(
  100,
  nrow = 2,
  ncol = 2
)

U0 <- c(0, 0)


# =============================================================================
# 8. COMMON DATA
# =============================================================================

data.common <- list(
  
  N = N,
  M = M,
  
  Y = Y,
  
  t = visit.times,
  
  randgrp1 = as.numeric(aids.id2$randgrp1),
  
  gender1 = as.numeric(aids.id2$gender1),
  
  prevoi1 = as.numeric(aids.id2$prevoi1),
  
  stratum1 = as.numeric(aids.id2$stratum1),
  
  surt = surt,
  
  surt.cen = surt.cen,
  
  betamu1 = betamu1,
  
  betamu2 = betamu2,
  
  Sigma1 = Sigma1,
  
  Sigma2 = Sigma2,
  
  U0 = U0,
  
  R = R
)


# =============================================================================
# 9. MODEL XI
# =============================================================================

model.XI <- "
model {

  for (i in 1:N) {

    # -----------------------------------------------------------------------
    # LONGITUDINAL MODEL
    # -----------------------------------------------------------------------

    for (j in 1:M) {

      Y[i,j] ~ dnorm(muy[i,j], tauz)

      muy[i,j] <-
          beta1[1]
        + beta1[2] * t[j]
        + beta1[3] * t[j] * randgrp1[i]
        + beta1[4] * gender1[i]
        + beta1[5] * prevoi1[i]
        + beta1[6] * stratum1[i]
        + U[i,1]
        + U[i,2] * t[j]
    }

    # -----------------------------------------------------------------------
    # SURVIVAL MODEL
    # MODEL XI:
    #
    # W2_i = r1 U1_i + r2 U2_i
    # -----------------------------------------------------------------------

    surt[i] ~ dweib(p, mut[i]) I(surt.cen[i], )

    log(mut[i]) <-
          beta2[1]
        + beta2[2] * randgrp1[i]
        + beta2[3] * gender1[i]
        + beta2[4] * prevoi1[i]
        + beta2[5] * stratum1[i]
        + r1 * U[i,1]
        + r2 * U[i,2]

    # Random effects

    U[i,1:2] ~ dmnorm(U0[], tau[,])
  }


  # -------------------------------------------------------------------------
  # EXPONENTIAL SURVIVAL MODEL
  # -------------------------------------------------------------------------

  p <- 1


  # -------------------------------------------------------------------------
  # DERIVED PARAMETERS
  # -------------------------------------------------------------------------

  sigmaz <- 1 / tauz

  sigma[1:2,1:2] <- inverse(tau[,])

  sigma1 <- sigma[1,1]
  sigma2 <- sigma[2,2]
  sigma12 <- sigma[1,2]

  cor <- sigma12 / sqrt(sigma1 * sigma2)


  # -------------------------------------------------------------------------
  # PRIORS
  # -------------------------------------------------------------------------

  tau[1:2,1:2] ~ dwish(R[,], 23)

  beta1[1:6] ~ dmnorm(
    betamu1[],
    Sigma1[,]
  )

  tauz ~ dgamma(0.1, 0.1)

  beta2[1:5] ~ dmnorm(
    betamu2[],
    Sigma2[,]
  )

  r1 ~ dnorm(0, 0.01)

  r2 ~ dnorm(0, 0.01)
}
"


model.file.XI <- file.path(
  working.directory,
  "Guo_Carlin_Model_XI.txt"
)

writeLines(
  model.XI,
  model.file.XI
)


# =============================================================================
# 10. MODEL XII
# =============================================================================
#
# This reproduces the WEBSITE Model XII.
#
# =============================================================================

model.XII <- "
model {

  for (i in 1:N) {

    # -----------------------------------------------------------------------
    # LONGITUDINAL MODEL
    # -----------------------------------------------------------------------

    for (j in 1:M) {

      Y[i,j] ~ dnorm(muy[i,j], tauz)

      muy[i,j] <-
          beta1[1]
        + beta1[2] * t[j]
        + beta1[3] * t[j] * randgrp1[i]
        + beta1[4] * gender1[i]
        + beta1[5] * prevoi1[i]
        + beta1[6] * stratum1[i]
        + U[i,1]
        + U[i,2] * t[j]
    }

    # -----------------------------------------------------------------------
    # SURVIVAL MODEL
    #
    # MODEL XII:
    #
    # W2_i(t) =
    #
    # r1 U1_i
    # + r2 U2_i
    # + r3 (U1_i + U2_i * tee_i)
    #
    # -----------------------------------------------------------------------

    surt[i] ~ dweib(p, mut[i]) I(surt.cen[i], )

    log(mut[i]) <-
          beta2[1]
        + beta2[2] * randgrp1[i]
        + beta2[3] * gender1[i]
        + beta2[4] * prevoi1[i]
        + beta2[5] * stratum1[i]
        + r1 * U[i,1]
        + r2 * U[i,2]
        + r3 * (U[i,1] + U[i,2] * tee[i])

    U[i,1:2] ~ dmnorm(U0[], tau[,])
  }


  # -------------------------------------------------------------------------
  # EXPONENTIAL MODEL
  # -------------------------------------------------------------------------

  p <- 1


  # -------------------------------------------------------------------------
  # DERIVED PARAMETERS
  # -------------------------------------------------------------------------

  sigmaz <- 1 / tauz

  sigma[1:2,1:2] <- inverse(tau[,])

  sigma1 <- sigma[1,1]
  sigma2 <- sigma[2,2]
  sigma12 <- sigma[1,2]

  cor <- sigma12 / sqrt(sigma1 * sigma2)


  # -------------------------------------------------------------------------
  # PRIORS
  # -------------------------------------------------------------------------

  tau[1:2,1:2] ~ dwish(R[,], 23)

  beta1[1:6] ~ dmnorm(
    betamu1[],
    Sigma1[,]
  )

  tauz ~ dgamma(0.1, 0.1)

  beta2[1:5] ~ dmnorm(
    betamu2[],
    Sigma2[,]
  )

  r1 ~ dnorm(0, 0.01)

  r2 ~ dnorm(0, 0.01)

  r3 ~ dnorm(0, 0.01)
}
"


model.file.XII <- file.path(
  working.directory,
  "Guo_Carlin_Model_XII.txt"
)

writeLines(
  model.XII,
  model.file.XII
)


# =============================================================================
# 11. DATA FOR MODEL XII
# =============================================================================

data.XII <- c(
  data.common,
  list(
    tee = tee
  )
)


# =============================================================================
# 12. INITIAL VALUES
# =============================================================================
#
# For censored subjects, surt is unknown and WinBUGS needs an initial latent
# survival time greater than the censoring time.
#
# =============================================================================


create.inits.XI <- function(chain) {
  
  set.seed(1000 + chain)
  
  surt.init <- rep(
    NA_real_,
    N
  )
  
  censored <- which(
    event == 0L
  )
  
  surt.init[censored] <-
    followup.time[censored] +
    runif(
      length(censored),
      0.1,
      2
    )
  
  
  list(
    
    beta1 = rnorm(
      6,
      0,
      0.1
    ),
    
    tauz = 1,
    
    beta2 = c(
      -4,
      rnorm(4, 0, 0.1)
    ),
    
    r1 = rnorm(
      1,
      0,
      0.05
    ),
    
    r2 = rnorm(
      1,
      0,
      0.05
    ),
    
    tau = diag(
      1,
      2
    ),
    
    U = matrix(
      rnorm(
        N * 2,
        0,
        0.05
      ),
      N,
      2
    ),
    
    surt = surt.init
  )
}



create.inits.XII <- function(chain) {
  
  set.seed(2000 + chain)
  
  surt.init <- rep(
    NA_real_,
    N
  )
  
  censored <- which(
    event == 0L
  )
  
  surt.init[censored] <-
    followup.time[censored] +
    runif(
      length(censored),
      0.1,
      2
    )
  
  
  list(
    
    beta1 = rnorm(
      6,
      0,
      0.1
    ),
    
    tauz = 1,
    
    beta2 = c(
      -4,
      rnorm(4, 0, 0.1)
    ),
    
    r1 = rnorm(
      1,
      0,
      0.05
    ),
    
    r2 = rnorm(
      1,
      0,
      0.05
    ),
    
    r3 = rnorm(
      1,
      0,
      0.05
    ),
    
    tau = diag(
      1,
      2
    ),
    
    U = matrix(
      rnorm(
        N * 2,
        0,
        0.05
      ),
      N,
      2
    ),
    
    surt = surt.init
  )
}


# =============================================================================
# 13. PARAMETERS TO MONITOR
# =============================================================================

parameters.XI <- c(
  
  "beta1",
  "beta2",
  
  "r1",
  "r2",
  
  "U",
  
  "tauz",
  
  "sigma1",
  "sigma2",
  "sigma12",
  
  "cor"
)


parameters.XII <- c(
  
  "beta1",
  "beta2",
  
  "r1",
  "r2",
  "r3",
  
  "tauz",
  
  "sigma1",
  "sigma2",
  "sigma12",
  
  "cor"
)


# =============================================================================
# 14. MCMC SETTINGS
# =============================================================================
#
# Use IDENTICAL settings for XI and XII.
#
# 5000 burn-in + 10000 retained iterations
#
# Therefore total n.iter = 15000.
#
# =============================================================================

n.chains <- 3L

n.iter <- 15000L

n.burnin <- 5000L

n.thin <- 1L


# =============================================================================
# 15. RUN MODEL XI
# =============================================================================

cat("\n")
cat("============================================================\n")
## ============================================================
cat("RUNNING GUO-CARLIN MODEL XI\n")
## RUNNING GUO-CARLIN MODEL XI
cat("============================================================\n")
## ============================================================
inits.XI <- lapply(
  seq_len(n.chains),
  create.inits.XI
)


fit.model.xi <- bugs(
  
  data = data.common,
  
  inits = inits.XI,
  
  parameters.to.save = parameters.XI,
  
  model.file = model.file.XI,
  
  n.chains = n.chains,
  
  n.iter = n.iter,
  
  n.burnin = n.burnin,
  
  n.thin = n.thin,
  
  DIC = TRUE,
  
  bugs.directory = bugs.directory,
  
  working.directory = working.directory,
  
  debug = FALSE,
  
  codaPkg = FALSE,
  
  clearWD = FALSE
)


cat("\nMODEL XI COMPLETE\n")
## 
## MODEL XI COMPLETE
print(
  fit.model.xi,
  digits = 4
)
## Inference for Bugs model at "D:/Joint_model/winBUGS/Guo_Carlin_Model_XI.txt", fit using WinBUGS,
##  3 chains, each with 15000 iterations (first 5000 discarded)
##  n.sims = 30000 iterations saved
##               mean      sd      2.5%       25%       50%       75%     97.5%
## beta1[1]    8.0321  0.3482    7.3450    7.8000    8.0370    8.2680    8.7020
## beta1[2]   -0.2618  0.0494   -0.3599   -0.2947   -0.2622   -0.2285   -0.1663
## beta1[3]    0.0235  0.0723   -0.1152   -0.0262    0.0221    0.0717    0.1672
## beta1[4]   -0.1023  0.3254   -0.7355   -0.3241   -0.1038    0.1156    0.5430
## beta1[5]   -2.3465  0.2514   -2.8430   -2.5150   -2.3460   -2.1760   -1.8530
## beta1[6]   -0.1100  0.2409   -0.5856   -0.2734   -0.1087    0.0564    0.3488
## beta2[1]   -4.0879  0.2119   -4.5260   -4.2270   -4.0800   -3.9420   -3.6950
## beta2[2]    0.2739  0.1843   -0.0838    0.1502    0.2712    0.3967    0.6389
## beta2[3]   -0.1186  0.1513   -0.4084   -0.2214   -0.1213   -0.0184    0.1887
## beta2[4]    0.7677  0.1349    0.5117    0.6761    0.7642    0.8567    1.0380
## beta2[5]    0.0739  0.0996   -0.1194    0.0069    0.0730    0.1407    0.2698
## r1         -0.1957  0.0295   -0.2557   -0.2150   -0.1950   -0.1754   -0.1400
## r2         -1.6027  0.2778   -2.1530   -1.7860   -1.6020   -1.4190   -1.0580
## U[1,1]      4.0069  1.4617    1.1599    3.0140    3.9920    5.0010    6.8870
## U[1,2]      0.1960  0.1919   -0.1828    0.0654    0.1971    0.3258    0.5689
## U[2,1]     -2.8392  1.3624   -5.5190   -3.7500   -2.8400   -1.9100   -0.1916
## U[2,2]      0.0853  0.1313   -0.1725   -0.0031    0.0854    0.1730    0.3444
## U[3,1]     -1.9892  1.3912   -4.6870   -2.9382   -1.9910   -1.0420    0.7507
## U[3,2]      0.4498  0.3117   -0.1527    0.2375    0.4471    0.6576    1.0640
## U[4,1]     -1.0228  1.2075   -3.3680   -1.8510   -1.0280   -0.2084    1.3340
## U[4,2]      0.0384  0.1811   -0.3153   -0.0847    0.0392    0.1609    0.3905
## U[5,1]      2.5518  1.2051    0.1752    1.7420    2.5605    3.3612    4.9110
## U[5,2]      0.1777  0.1797   -0.1710    0.0556    0.1770    0.2997    0.5275
## U[6,1]     -1.2304  1.6463   -4.4721   -2.3403   -1.2250   -0.1195    1.9830
## U[6,2]     -0.4063  0.5560   -1.4560   -0.7917   -0.4214   -0.0417    0.7298
## U[7,1]      0.6155  1.2284   -1.8020   -0.2119    0.6162    1.4372    3.0240
## U[7,2]     -0.0047  0.1793   -0.3595   -0.1230   -0.0031    0.1157    0.3432
## U[8,1]     -7.1222  1.3745   -9.8250   -8.0410   -7.1270   -6.1950   -4.4650
## U[8,2]     -0.3472  0.3147   -0.9656   -0.5617   -0.3475   -0.1328    0.2669
## U[9,1]     -2.6770  1.2832   -5.1760   -3.5410   -2.6740   -1.8150   -0.1655
## U[9,2]      0.4105  0.4940   -0.5154    0.0666    0.3974    0.7412    1.4060
## U[10,1]     6.7398  1.2262    4.3480    5.9130    6.7430    7.5690    9.1430
## U[10,2]    -0.1269  0.1808   -0.4828   -0.2469   -0.1273   -0.0050    0.2260
## U[11,1]     0.6369  1.5859   -2.4500   -0.4317    0.6337    1.7073    3.7640
## U[11,2]    -0.4830  0.5748   -1.5650   -0.8830   -0.4956   -0.1035    0.6782
## U[12,1]     3.9479  1.1454    1.6910    3.1810    3.9420    4.7160    6.2040
## U[12,2]     0.0284  0.1207   -0.2081   -0.0537    0.0285    0.1106    0.2643
## U[13,1]    -6.3510  1.3111   -8.9240   -7.2383   -6.3480   -5.4708   -3.7930
## U[13,2]    -0.0393  0.3249   -0.6765   -0.2579   -0.0415    0.1808    0.5978
## U[14,1]    -6.9811  1.3000   -9.5290   -7.8550   -6.9830   -6.1030   -4.4580
## U[14,2]    -0.3036  0.5263   -1.3280   -0.6636   -0.3083    0.0479    0.7436
## U[15,1]     5.0030  1.2101    2.6350    4.1860    5.0020    5.8170    7.3850
## U[15,2]     0.0826  0.1809   -0.2738   -0.0391    0.0833    0.2048    0.4343
## U[16,1]    -3.6270  1.2986   -6.1760   -4.5060   -3.6220   -2.7540   -1.0830
## U[16,2]     0.4896  0.3217   -0.1364    0.2703    0.4915    0.7043    1.1220
## U[17,1]    -4.0923  1.2169   -6.4930   -4.9000   -4.0850   -3.2750   -1.7210
## U[17,2]     0.1213  0.1776   -0.2275    0.0022    0.1214    0.2401    0.4715
## U[18,1]    -0.1161  1.2253   -2.5190   -0.9379   -0.1261    0.7096    2.2890
## U[18,2]    -0.0046  0.1797   -0.3589   -0.1251   -0.0033    0.1147    0.3497
## U[19,1]    -2.6467  1.6384   -5.8620   -3.7560   -2.6430   -1.5360    0.5383
## U[19,2]    -0.2701  0.5263   -1.2550   -0.6325   -0.2872    0.0778    0.8073
## U[20,1]    12.3328  1.2192    9.8870   11.5100   12.3400   13.1600   14.7102
## U[20,2]     0.1497  0.1809   -0.2036    0.0269    0.1494    0.2720    0.5071
## U[21,1]     0.9734  1.3018   -1.5710    0.0914    0.9642    1.8540    3.5100
## U[21,2]    -0.3264  0.3192   -0.9465   -0.5436   -0.3290   -0.1127    0.3007
## U[22,1]    -7.8556  1.2213  -10.2600   -8.6770   -7.8610   -7.0287   -5.4470
## U[22,2]     0.1679  0.1811   -0.1860    0.0447    0.1688    0.2913    0.5217
## U[23,1]    -5.7813  1.6445   -8.9961   -6.9090   -5.7820   -4.6650   -2.5550
## U[23,2]    -0.1267  0.5091   -1.0830   -0.4754   -0.1450    0.2034    0.9212
## U[24,1]     4.2960  1.2270    1.8660    3.4720    4.3040    5.1320    6.6740
## U[24,2]     0.2670  0.1219    0.0289    0.1845    0.2681    0.3499    0.5044
## U[25,1]    -3.0431  1.6450   -6.2740   -4.1390   -3.0490   -1.9380    0.1788
## U[25,2]    -0.1727  0.5076   -1.1160   -0.5223   -0.1925    0.1564    0.8835
## U[26,1]     8.5041  1.1472    6.2570    7.7360    8.5050    9.2700   10.7800
## U[26,2]     0.0263  0.1210   -0.2088   -0.0552    0.0256    0.1076    0.2672
## U[27,1]    -5.9769  1.3432   -8.6220   -6.8770   -5.9770   -5.0728   -3.3320
## U[27,2]     0.0725  0.1284   -0.1791   -0.0143    0.0718    0.1590    0.3268
## U[28,1]     9.7014  1.5795    6.5970    8.6390    9.7045   10.7700   12.7800
## U[28,2]     0.0305  0.5820   -1.0880   -0.3643    0.0193    0.4182    1.2000
## U[29,1]    -0.9098  1.5575   -3.9560   -1.9590   -0.8997    0.1346    2.1670
## U[29,2]    -0.2069  0.5059   -1.1520   -0.5561   -0.2255    0.1216    0.8409
## U[30,1]    -4.2249  1.5729   -7.3210   -5.2810   -4.2280   -3.1600   -1.1590
## U[30,2]    -0.0098  0.3232   -0.6443   -0.2266   -0.0096    0.2068    0.6259
## U[31,1]     3.6804  1.3814    0.9694    2.7490    3.7010    4.5940    6.3990
## U[31,2]    -0.2925  0.3151   -0.9096   -0.5079   -0.2908   -0.0829    0.3261
## U[32,1]    -3.3215  1.5040   -6.2860   -4.3290   -3.3200   -2.3070   -0.3950
## U[32,2]    -0.0253  0.3194   -0.6423   -0.2414   -0.0269    0.1889    0.6044
## U[33,1]     1.8428  1.2379   -0.5886    1.0077    1.8410    2.6760    4.2720
## U[33,2]     0.0285  0.1288   -0.2249   -0.0577    0.0289    0.1157    0.2817
## U[34,1]    -4.0029  1.3692   -6.6740   -4.9220   -3.9985   -3.0817   -1.3010
## U[34,2]     0.3091  0.1329    0.0479    0.2197    0.3094    0.3976    0.5691
## U[35,1]     0.4754  1.1493   -1.7910   -0.2960    0.4809    1.2500    2.7290
## U[35,2]    -0.0620  0.1226   -0.2999   -0.1445   -0.0614    0.0194    0.1800
## U[36,1]    -4.5976  1.5048   -7.5260   -5.6200   -4.5990   -3.5840   -1.6470
## U[36,2]     0.1585  0.3205   -0.4711   -0.0578    0.1586    0.3744    0.7860
## U[37,1]    -1.7218  1.2922   -4.2840   -2.5840   -1.7170   -0.8486    0.7885
## U[37,2]    -0.0612  0.3125   -0.6650   -0.2754   -0.0631    0.1495    0.5562
## U[38,1]     5.1901  1.3989    2.4660    4.2430    5.1980    6.1210    7.9540
## U[38,2]     0.0031  0.5395   -1.0430   -0.3617    0.0012    0.3623    1.0610
## U[39,1]    -0.2579  1.4397   -3.0660   -1.2260   -0.2500    0.7266    2.5510
## U[39,2]    -0.1800  0.1871   -0.5459   -0.3071   -0.1806   -0.0529    0.1856
## U[40,1]     4.7459  1.2939    2.2130    3.8700    4.7410    5.6230    7.2950
## U[40,2]    -0.0639  0.5405   -1.1060   -0.4330   -0.0679    0.2969    1.0020
## U[41,1]    -1.2236  1.2728   -3.7250   -2.0730   -1.2200   -0.3658    1.2580
## U[41,2]     0.0189  0.1809   -0.3337   -0.1029    0.0175    0.1395    0.3790
## U[42,1]    -1.8305  1.6442   -5.0510   -2.9310   -1.8275   -0.7195    1.3960
## U[42,2]     0.1655  0.5697   -0.9174   -0.2266    0.1552    0.5407    1.3120
## U[43,1]     5.1593  1.5780    2.0670    4.0940    5.1610    6.2330    8.2730
## U[43,2]    -0.0078  0.6038   -1.1810   -0.4166   -0.0159    0.3959    1.1910
## U[44,1]    -4.6755  1.3031   -7.2080   -5.5590   -4.6870   -3.7910   -2.1250
## U[44,2]    -0.1619  0.3255   -0.7937   -0.3850   -0.1624    0.0560    0.4823
## U[45,1]    -3.2419  1.5601   -6.3040   -4.2800   -3.2520   -2.1790   -0.1736
## U[45,2]    -0.0767  0.4879   -0.9824   -0.4170   -0.0919    0.2462    0.9142
## U[46,1]    -3.9714  1.2941   -6.4900   -4.8470   -3.9640   -3.1050   -1.4170
## U[46,2]    -0.3896  0.3219   -1.0230   -0.6065   -0.3888   -0.1720    0.2437
## U[47,1]    -1.4466  1.3874   -4.1440   -2.3700   -1.4455   -0.5165    1.2890
## U[47,2]    -0.0584  0.4577   -0.9181   -0.3719   -0.0680    0.2422    0.8662
## U[48,1]    -3.6711  1.2885   -6.1820   -4.5440   -3.6680   -2.8010   -1.1410
## U[48,2]    -0.0985  0.4791   -0.9983   -0.4277   -0.1112    0.2161    0.8790
## U[49,1]    -8.2456  1.5702  -11.3000   -9.3010   -8.2450   -7.2050   -5.1330
## U[49,2]    -0.3803  0.5746   -1.4740   -0.7757   -0.3920    0.0029    0.7849
## U[50,1]     4.1386  1.3170    1.5510    3.2460    4.1470    5.0270    6.7150
## U[50,2]    -0.5250  0.1809   -0.8765   -0.6476   -0.5256   -0.4049   -0.1693
## U[51,1]    -1.6945  1.3037   -4.2230   -2.5910   -1.6950   -0.8246    0.8944
## U[51,2]    -0.0079  0.4851   -0.9259   -0.3387   -0.0191    0.3114    0.9774
## U[52,1]    -4.1300  1.2998   -6.6720   -4.9960   -4.1330   -3.2588   -1.6060
## U[52,2]    -0.2652  0.4679   -1.1530   -0.5844   -0.2732    0.0420    0.6829
## U[53,1]    -1.7775  1.5577   -4.8040   -2.8260   -1.7850   -0.7310    1.2860
## U[53,2]    -0.2723  0.5191   -1.2430   -0.6343   -0.2912    0.0706    0.7911
## U[54,1]     6.2722  1.2090    3.8720    5.4620    6.2740    7.0910    8.6320
## U[54,2]     0.0896  0.1797   -0.2610   -0.0330    0.0900    0.2097    0.4439
## U[55,1]    -2.1243  1.2154   -4.5010   -2.9470   -2.1265   -1.3000    0.2580
## U[55,2]     0.1993  0.1781   -0.1486    0.0783    0.1980    0.3194    0.5506
## U[56,1]     1.2857  1.2155   -1.1010    0.4690    1.2800    2.1060    3.6520
## U[56,2]     0.0239  0.1796   -0.3266   -0.0972    0.0231    0.1450    0.3815
## U[57,1]    -1.0825  1.2871   -3.6180   -1.9520   -1.0780   -0.2163    1.4340
## U[57,2]     0.0266  0.3139   -0.5853   -0.1844    0.0246    0.2370    0.6467
## U[58,1]    -7.3209  1.2978   -9.8601   -8.1910   -7.3220   -6.4560   -4.7750
## U[58,2]     0.0320  0.3194   -0.5862   -0.1850    0.0319    0.2489    0.6555
## U[59,1]     3.2200  1.3087    0.6671    2.3360    3.2200    4.1020    5.8000
## U[59,2]    -0.4051  0.3208   -1.0290   -0.6222   -0.4034   -0.1903    0.2213
## U[60,1]    -2.2014  1.4163   -4.9900   -3.1480   -2.2010   -1.2450    0.5838
## U[60,2]     0.0682  0.1857   -0.2944   -0.0562    0.0684    0.1915    0.4350
## U[61,1]     6.5651  1.3007    4.0180    5.6930    6.5730    7.4400    9.1240
## U[61,2]     0.2681  0.5339   -0.7668   -0.0934    0.2642    0.6260    1.3070
## U[62,1]     4.8945  1.2132    2.4950    4.0840    4.9010    5.7072    7.2530
## U[62,2]    -0.0163  0.1796   -0.3685   -0.1370   -0.0170    0.1049    0.3405
## U[63,1]     9.3363  1.2174    6.9360    8.5180    9.3400   10.1500   11.7100
## U[63,2]    -0.1171  0.1803   -0.4690   -0.2390   -0.1170    0.0049    0.2353
## U[64,1]     0.1878  1.2930   -2.3650   -0.6752    0.1893    1.0470    2.7250
## U[64,2]    -0.2954  0.3174   -0.9132   -0.5074   -0.2956   -0.0834    0.3315
## U[65,1]    -1.6036  1.5797   -4.6850   -2.6700   -1.6105   -0.5450    1.5020
## U[65,2]    -0.3446  0.5394   -1.3570   -0.7147   -0.3585    0.0100    0.7495
## U[66,1]     1.2599  1.4800   -1.6510    0.2670    1.2580    2.2680    4.1400
## U[66,2]    -0.1293  0.3146   -0.7407   -0.3430   -0.1308    0.0802    0.4965
## U[67,1]    -1.1903  1.4940   -4.1490   -2.1960   -1.1850   -0.1732    1.7330
## U[67,2]    -0.0752  0.3175   -0.6841   -0.2920   -0.0778    0.1368    0.5541
## U[68,1]     5.6918  1.2083    3.3050    4.8840    5.6865    6.5052    8.0480
## U[68,2]    -0.4472  0.1800   -0.8022   -0.5684   -0.4469   -0.3264   -0.0936
## U[69,1]    -3.1004  1.5666   -6.1620   -4.1460   -3.0970   -2.0458   -0.0272
## U[69,2]    -0.4770  0.5855   -1.5820   -0.8849   -0.4872   -0.0847    0.6950
## U[70,1]     1.4594  1.3030   -1.0820    0.5841    1.4605    2.3283    4.0440
## U[70,2]     0.4667  0.3242   -0.1686    0.2486    0.4679    0.6814    1.1070
## U[71,1]    -2.9935  1.2945   -5.5320   -3.8670   -2.9960   -2.1250   -0.4266
## U[71,2]    -0.1587  0.4844   -1.0780   -0.4921   -0.1690    0.1644    0.8178
## U[72,1]     3.7628  1.2154    1.3670    2.9530    3.7670    4.5750    6.1300
## U[72,2]     0.2053  0.1803   -0.1497    0.0846    0.2042    0.3274    0.5597
## U[73,1]    -4.2389  1.5812   -7.3430   -5.3140   -4.2340   -3.1710   -1.1690
## U[73,2]    -0.3750  0.5513   -1.4050   -0.7550   -0.3946   -0.0090    0.7453
## U[74,1]    -0.5577  1.2192   -2.9450   -1.3830   -0.5510    0.2597    1.8200
## U[74,2]     0.0090  0.1805   -0.3420   -0.1132    0.0076    0.1306    0.3667
## U[75,1]     3.9420  1.2833    1.4090    3.0790    3.9420    4.8200    6.4320
## U[75,2]    -0.1481  0.3222   -0.7695   -0.3682   -0.1502    0.0680    0.4874
## U[76,1]    -5.3152  1.2194   -7.7010   -6.1380   -5.3105   -4.5040   -2.9180
## U[76,2]     0.0984  0.1802   -0.2544   -0.0217    0.0975    0.2196    0.4527
## U[77,1]    -2.3310  1.2810   -4.8490   -3.1840   -2.3295   -1.4750    0.1764
## U[77,2]    -0.1104  0.3131   -0.7252   -0.3237   -0.1121    0.0997    0.5070
## U[78,1]    -1.0906  1.2156   -3.4870   -1.9020   -1.0895   -0.2738    1.3160
## U[78,2]     0.4156  0.1809    0.0615    0.2931    0.4150    0.5373    0.7735
## U[79,1]    -4.4236  1.2285   -6.8190   -5.2460   -4.4290   -3.6010   -2.0070
## U[79,2]     0.0478  0.1817   -0.3091   -0.0744    0.0477    0.1705    0.4032
## U[80,1]     3.0554  1.2133    0.6450    2.2430    3.0610    3.8700    5.4100
## U[80,2]     0.5261  0.1803    0.1747    0.4043    0.5263    0.6469    0.8809
## U[81,1]    -2.8653  1.2944   -5.4040   -3.7470   -2.8600   -1.9830   -0.3274
## U[81,2]    -0.2355  0.4961   -1.1860   -0.5753   -0.2456    0.0979    0.7640
## U[82,1]     0.6046  1.1323   -1.6000   -0.1701    0.6055    1.3660    2.8240
## U[82,2]     0.0394  0.1269   -0.2095   -0.0455    0.0397    0.1253    0.2861
## U[83,1]     1.7008  1.2871   -0.8500    0.8417    1.7040    2.5640    4.2060
## U[83,2]    -0.2284  0.5089   -1.1990   -0.5791   -0.2412    0.1101    0.7974
## U[84,1]     0.7220  1.3030   -1.8420   -0.1558    0.7222    1.5990    3.2880
## U[84,2]    -0.1092  0.4786   -1.0280   -0.4357   -0.1149    0.2065    0.8524
## U[85,1]    -0.0549  1.3130   -2.6120   -0.9400   -0.0602    0.8264    2.5190
## U[85,2]     0.2314  0.1797   -0.1185    0.1082    0.2318    0.3522    0.5844
## U[86,1]    10.4861  1.2369    8.0740    9.6520   10.4800   11.3200   12.9100
## U[86,2]     0.3934  0.1811    0.0385    0.2700    0.3940    0.5143    0.7483
## U[87,1]    -0.7955  1.2822   -3.3040   -1.6640   -0.7946    0.0676    1.7210
## U[87,2]     0.0559  0.3186   -0.5682   -0.1564    0.0566    0.2678    0.6865
## U[88,1]    -1.1686  1.2992   -3.7110   -2.0360   -1.1670   -0.2930    1.3681
## U[88,2]    -0.0994  0.3193   -0.7212   -0.3146   -0.1010    0.1128    0.5282
## U[89,1]    -7.3116  1.2345   -9.7250   -8.1440   -7.3110   -6.4788   -4.8860
## U[89,2]     0.3403  0.1206    0.1041    0.2596    0.3407    0.4214    0.5770
## U[90,1]     3.8113  1.2056    1.4570    3.0040    3.8080    4.6220    6.1921
## U[90,2]     0.4240  0.1788    0.0734    0.3039    0.4236    0.5441    0.7735
## U[91,1]    -2.7254  1.1478   -4.9900   -3.5002   -2.7125   -1.9540   -0.4899
## U[91,2]     0.0664  0.1215   -0.1713   -0.0158    0.0666    0.1482    0.3037
## U[92,1]     1.6126  1.1335   -0.6073    0.8407    1.6215    2.3860    3.8320
## U[92,2]     0.2418  0.1215    0.0045    0.1597    0.2415    0.3239    0.4816
## U[93,1]     6.8905  1.2173    4.4870    6.0760    6.8910    7.7120    9.2690
## U[93,2]     0.5217  0.1800    0.1674    0.4005    0.5209    0.6438    0.8765
## U[94,1]     0.3161  1.2298   -2.0930   -0.5129    0.3063    1.1482    2.7490
## U[94,2]     0.0657  0.1815   -0.2871   -0.0577    0.0655    0.1899    0.4202
## U[95,1]    -0.0131  1.2219   -2.4100   -0.8354   -0.0113    0.8147    2.3450
## U[95,2]     0.3828  0.1810    0.0299    0.2606    0.3820    0.5045    0.7394
## U[96,1]     5.1850  1.4456    2.3310    4.2090    5.1830    6.1600    7.9930
## U[96,2]     0.4019  0.1901    0.0296    0.2747    0.4019    0.5303    0.7749
## U[97,1]     0.0029  1.2818   -2.5160   -0.8628    0.0047    0.8647    2.5060
## U[97,2]     0.1124  0.4721   -0.7850   -0.2099    0.1007    0.4195    1.0680
## U[98,1]     0.4511  1.2868   -2.0770   -0.4170    0.4454    1.3240    2.9820
## U[98,2]     0.2323  0.3226   -0.3955    0.0136    0.2319    0.4486    0.8704
## U[99,1]    -4.9630  1.4971   -7.9000   -5.9800   -4.9580   -3.9468   -2.0360
## U[99,2]    -0.2460  0.3248   -0.8828   -0.4647   -0.2451   -0.0282    0.3973
## U[100,1]   -0.0887  1.2959   -2.6470   -0.9717   -0.0874    0.7758    2.4620
## U[100,2]    0.1647  0.3234   -0.4670   -0.0540    0.1666    0.3843    0.7945
## U[101,1]    7.9623  1.2138    5.5920    7.1340    7.9620    8.7750   10.3500
## U[101,2]   -0.4184  0.1806   -0.7715   -0.5409   -0.4163   -0.2970   -0.0637
## U[102,1]   -2.8859  1.2889   -5.3960   -3.7500   -2.8930   -2.0150   -0.3533
## U[102,2]   -0.2122  0.4688   -1.0990   -0.5337   -0.2229    0.0948    0.7430
## U[103,1]   -2.2631  1.2542   -4.6910   -3.1090   -2.2720   -1.4280    0.2274
## U[103,2]    0.1848  0.1809   -0.1707    0.0632    0.1857    0.3072    0.5387
## U[104,1]   -1.0120  1.2845   -3.5520   -1.8790   -1.0010   -0.1416    1.5050
## U[104,2]    0.1676  0.3208   -0.4594   -0.0499    0.1665    0.3852    0.8027
## U[105,1]   -2.3344  1.3067   -4.8880   -3.2170   -2.3390   -1.4618    0.2596
## U[105,2]   -0.1528  0.4617   -1.0320   -0.4650   -0.1654    0.1573    0.7830
## U[106,1]    7.1257  1.2220    4.7210    6.3040    7.1220    7.9480    9.5530
## U[106,2]    0.2386  0.1823   -0.1163    0.1142    0.2396    0.3627    0.5951
## U[107,1]    2.0564  1.2886   -0.4855    1.1880    2.0500    2.9310    4.5841
## U[107,2]    0.0991  0.3207   -0.5278   -0.1198    0.0979    0.3136    0.7363
## U[108,1]   -3.7459  1.5690   -6.7861   -4.8110   -3.7510   -2.6920   -0.6581
## U[108,2]   -0.4285  0.5686   -1.5060   -0.8223   -0.4436   -0.0501    0.7202
## U[109,1]    1.6730  1.5747   -1.3980    0.6090    1.6670    2.7210    4.7620
## U[109,2]   -0.4249  0.5507   -1.4520   -0.8049   -0.4434   -0.0617    0.7113
## U[110,1]   10.0765  1.3150    7.4960    9.1790   10.0700   10.9600   12.6700
## U[110,2]    0.1740  0.5464   -0.8992   -0.1984    0.1731    0.5451    1.2430
## U[111,1]    0.3549  1.2836   -2.1580   -0.5122    0.3612    1.2130    2.8800
## U[111,2]    0.0652  0.3149   -0.5462   -0.1489    0.0625    0.2758    0.6873
## U[112,1]   -3.7820  1.3074   -6.3590   -4.6640   -3.7825   -2.9057   -1.2200
## U[112,2]    0.0304  0.5173   -0.9579   -0.3222    0.0238    0.3771    1.0560
## U[113,1]    1.7596  1.5532   -1.2620    0.7063    1.7640    2.8010    4.8080
## U[113,2]    0.2371  0.5374   -0.7667   -0.1362    0.2236    0.5899    1.3380
## U[114,1]   -3.1505  1.3026   -5.6990   -4.0300   -3.1530   -2.2630   -0.6155
## U[114,2]    0.0194  0.3149   -0.5915   -0.1947    0.0192    0.2306    0.6470
## U[115,1]    0.9101  1.2874   -1.5990    0.0490    0.9140    1.7790    3.4080
## U[115,2]   -0.2874  0.4581   -1.1540   -0.6003   -0.2966    0.0166    0.6420
## U[116,1]   -0.2513  1.2802   -2.7410   -1.1150   -0.2502    0.6005    2.2500
## U[116,2]    0.1603  0.4959   -0.7889   -0.1781    0.1493    0.4901    1.1540
## U[117,1]    2.7821  1.4361   -0.0276    1.8190    2.7860    3.7482    5.5830
## U[117,2]   -0.0908  0.1898   -0.4612   -0.2173   -0.0925    0.0367    0.2872
## U[118,1]   -2.0772  1.5609   -5.1380   -3.1310   -2.0810   -1.0320    0.9944
## U[118,2]   -0.1571  0.4990   -1.0800   -0.5006   -0.1766    0.1672    0.8699
## U[119,1]    1.2507  1.5140   -1.7250    0.2355    1.2495    2.2710    4.2230
## U[119,2]   -0.5232  0.3288   -1.1680   -0.7469   -0.5233   -0.3049    0.1253
## U[120,1]   -5.0553  1.6359   -8.2620   -6.1562   -5.0580   -3.9500   -1.8580
## U[120,2]   -0.0820  0.4966   -1.0040   -0.4210   -0.1001    0.2413    0.9472
## U[121,1]   -2.4526  1.2070   -4.8210   -3.2670   -2.4510   -1.6367   -0.0962
## U[121,2]    0.0317  0.1799   -0.3209   -0.0895    0.0321    0.1519    0.3818
## U[122,1]   -2.9915  1.3039   -5.5410   -3.8710   -2.9970   -2.1020   -0.4381
## U[122,2]    0.2271  0.4828   -0.6901   -0.1047    0.2223    0.5502    1.1930
## U[123,1]    2.2695  1.5575   -0.7867    1.2260    2.2630    3.3062    5.3360
## U[123,2]   -0.1790  0.1895   -0.5508   -0.3065   -0.1779   -0.0507    0.1891
## U[124,1]   -1.3953  1.2241   -3.7910   -2.2150   -1.4020   -0.5741    1.0200
## U[124,2]    0.1996  0.1796   -0.1497    0.0795    0.1986    0.3204    0.5517
## U[125,1]   -2.5014  1.2130   -4.8810   -3.3250   -2.5010   -1.6860   -0.1180
## U[125,2]    0.1328  0.1778   -0.2169    0.0131    0.1324    0.2527    0.4837
## U[126,1]   -2.9160  1.2140   -5.3070   -3.7280   -2.9110   -2.0958   -0.5594
## U[126,2]   -0.1896  0.1778   -0.5357   -0.3095   -0.1896   -0.0696    0.1578
## U[127,1]    3.0232  1.2190    0.6340    2.2010    3.0200    3.8450    5.4310
## U[127,2]    0.2470  0.1804   -0.1051    0.1251    0.2465    0.3687    0.6001
## U[128,1]   -1.6856  1.5592   -4.7440   -2.7310   -1.6870   -0.6367    1.3590
## U[128,2]   -0.3095  0.5275   -1.2920   -0.6716   -0.3280    0.0330    0.7697
## U[129,1]   -1.1261  1.2899   -3.6550   -2.0032   -1.1230   -0.2536    1.4190
## U[129,2]   -0.0420  0.3149   -0.6633   -0.2546   -0.0416    0.1693    0.5791
## U[130,1]    3.2979  1.1415    1.0660    2.5300    3.2920    4.0650    5.5140
## U[130,2]   -0.1285  0.1206   -0.3627   -0.2109   -0.1289   -0.0477    0.1102
## U[131,1]    5.3771  1.3943    2.6370    4.4367    5.3765    6.3080    8.1260
## U[131,2]    1.4799  0.5620    0.3840    1.1020    1.4780    1.8580    2.5870
## U[132,1]   -4.9617  1.2153   -7.3010   -5.7940   -4.9680   -4.1360   -2.5760
## U[132,2]    0.0341  0.1801   -0.3212   -0.0868    0.0348    0.1555    0.3861
## U[133,1]   -0.3704  1.2047   -2.7210   -1.1830   -0.3724    0.4330    2.0110
## U[133,2]   -0.0347  0.1797   -0.3888   -0.1554   -0.0341    0.0863    0.3134
## U[134,1]   -1.9821  1.2951   -4.4960   -2.8580   -1.9810   -1.1147    0.5636
## U[134,2]    0.0815  0.3138   -0.5288   -0.1309    0.0805    0.2915    0.7047
## U[135,1]   -3.1852  1.2234   -5.5670   -4.0100   -3.1790   -2.3580   -0.7894
## U[135,2]   -0.0894  0.1795   -0.4419   -0.2117   -0.0893    0.0315    0.2627
## U[136,1]   -1.2040  1.2920   -3.7490   -2.0730   -1.1970   -0.3389    1.3270
## U[136,2]   -0.4816  0.3237   -1.1120   -0.7032   -0.4810   -0.2617    0.1571
## U[137,1]   -2.6610  1.1418   -4.8830   -3.4320   -2.6690   -1.8940   -0.3958
## U[137,2]   -0.0821  0.1214   -0.3227   -0.1636   -0.0812    0.0004    0.1527
## U[138,1]   -3.8115  1.2950   -6.3950   -4.6710   -3.8050   -2.9430   -1.2740
## U[138,2]   -0.1624  0.3217   -0.7907   -0.3795   -0.1637    0.0536    0.4665
## U[139,1]   -4.1465  1.1485   -6.4040   -4.9220   -4.1540   -3.3780   -1.8940
## U[139,2]    0.0949  0.1203   -0.1414    0.0140    0.0956    0.1755    0.3305
## U[140,1]   -2.4810  1.4867   -5.3920   -3.4902   -2.4925   -1.4740    0.4474
## U[140,2]   -0.0586  0.3119   -0.6719   -0.2704   -0.0602    0.1520    0.5560
## U[141,1]   -3.2447  1.3020   -5.8110   -4.1240   -3.2430   -2.3630   -0.7116
## U[141,2]    0.0590  0.3146   -0.5484   -0.1546    0.0555    0.2689    0.6860
## U[142,1]    4.3550  1.2200    1.9580    3.5340    4.3600    5.1762    6.7220
## U[142,2]   -0.0066  0.1806   -0.3582   -0.1285   -0.0064    0.1155    0.3492
## U[143,1]    2.1507  1.2542   -0.3207    1.3090    2.1500    2.9870    4.6250
## U[143,2]    0.1658  0.1809   -0.1912    0.0448    0.1661    0.2868    0.5214
## U[144,1]    4.9791  1.2091    2.5940    4.1680    4.9790    5.7940    7.3430
## U[144,2]    0.2605  0.1807   -0.0981    0.1391    0.2613    0.3838    0.6111
## U[145,1]    3.0646  1.2267    0.6698    2.2328    3.0610    3.8982    5.4600
## U[145,2]    0.1117  0.1811   -0.2399   -0.0104    0.1123    0.2332    0.4675
## U[146,1]    6.8402  1.2046    4.4370    6.0310    6.8410    7.6500    9.1920
## U[146,2]   -0.1819  0.1792   -0.5354   -0.3031   -0.1820   -0.0613    0.1729
## U[147,1]   -1.6162  1.2931   -4.1580   -2.4840   -1.6110   -0.7418    0.9187
## U[147,2]   -0.2902  0.3091   -0.8923   -0.4983   -0.2907   -0.0842    0.3215
## U[148,1]    2.6591  1.2214    0.2579    1.8277    2.6590    3.4870    5.0590
## U[148,2]    0.1600  0.1807   -0.1945    0.0386    0.1609    0.2808    0.5133
## U[149,1]    0.9036  1.2675   -1.5720    0.0469    0.9047    1.7502    3.3970
## U[149,2]    0.0642  0.1823   -0.2935   -0.0575    0.0659    0.1857    0.4202
## U[150,1]   -8.2584  1.2204  -10.6300   -9.0830   -8.2620   -7.4338   -5.8610
## U[150,2]    0.0625  0.1800   -0.2936   -0.0581    0.0630    0.1839    0.4153
## U[151,1]   -1.7160  1.2852   -4.2201   -2.5740   -1.7170   -0.8552    0.8052
## U[151,2]   -0.5924  0.4983   -1.5310   -0.9365   -0.6046   -0.2607    0.4212
## U[152,1]    5.8112  1.4989    2.8940    4.8038    5.8045    6.8270    8.7520
## U[152,2]    0.4417  0.3307   -0.2056    0.2186    0.4414    0.6650    1.0890
## U[153,1]    1.0623  1.2208   -1.3210    0.2319    1.0640    1.8960    3.4340
## U[153,2]   -0.0744  0.1791   -0.4242   -0.1953   -0.0745    0.0456    0.2785
## U[154,1]   -3.9113  1.2088   -6.2800   -4.7280   -3.9040   -3.1030   -1.5520
## U[154,2]   -0.0942  0.1800   -0.4469   -0.2169   -0.0929    0.0275    0.2593
## U[155,1]   -3.3923  1.2350   -5.8150   -4.2270   -3.3820   -2.5550   -0.9817
## U[155,2]    0.2439  0.1812   -0.1102    0.1226    0.2436    0.3639    0.6004
## U[156,1]   -4.6145  1.5600   -7.6440   -5.6660   -4.6195   -3.5650   -1.5640
## U[156,2]    0.0133  0.4760   -0.8700   -0.3150   -0.0042    0.3188    1.0060
## U[157,1]    6.1628  1.2330    3.7430    5.3300    6.1630    6.9890    8.5890
## U[157,2]    0.0867  0.1223   -0.1540    0.0036    0.0882    0.1695    0.3251
## U[158,1]    4.2540  1.4578    1.4090    3.2690    4.2490    5.2440    7.1120
## U[158,2]    0.0392  0.1921   -0.3399   -0.0895    0.0401    0.1691    0.4151
## U[159,1]    6.0830  1.2578    3.6100    5.2290    6.0950    6.9350    8.5130
## U[159,2]    0.3447  0.1819   -0.0153    0.2227    0.3451    0.4673    0.7007
## U[160,1]    6.9483  1.3670    4.2570    6.0280    6.9430    7.8722    9.6380
## U[160,2]    0.5647  0.1807    0.2098    0.4434    0.5652    0.6867    0.9180
## U[161,1]    3.6578  1.2069    1.2960    2.8530    3.6650    4.4720    6.0150
## U[161,2]   -0.0490  0.1792   -0.3982   -0.1692   -0.0501    0.0712    0.2999
## U[162,1]    0.3627  1.2006   -1.9720   -0.4520    0.3676    1.1850    2.7000
## U[162,2]   -0.0006  0.1785   -0.3521   -0.1203   -0.0006    0.1188    0.3483
## U[163,1]   -1.0170  1.2877   -3.5250   -1.8950   -1.0170   -0.1556    1.5260
## U[163,2]    0.0251  0.5018   -0.9242   -0.3226    0.0150    0.3592    1.0350
## U[164,1]   -0.0815  1.5496   -3.1170   -1.1250   -0.0750    0.9634    2.9700
## U[164,2]   -0.1309  0.4873   -1.0430   -0.4706   -0.1506    0.1878    0.8770
## U[165,1]    1.4836  1.1504   -0.7452    0.7128    1.4720    2.2570    3.7660
## U[165,2]    0.1380  0.1216   -0.1005    0.0560    0.1385    0.2210    0.3731
## U[166,1]    1.1530  1.4524   -1.6890    0.1665    1.1575    2.1390    3.9880
## U[166,2]   -0.0508  0.1904   -0.4236   -0.1790   -0.0502    0.0760    0.3224
## U[167,1]   -1.2754  1.2015   -3.6130   -2.0962   -1.2910   -0.4672    1.0890
## U[167,2]   -0.0779  0.1796   -0.4338   -0.1990   -0.0769    0.0424    0.2735
## U[168,1]   -1.1852  1.2945   -3.7010   -2.0700   -1.1870   -0.3146    1.3500
## U[168,2]    0.1642  0.3193   -0.4577   -0.0525    0.1630    0.3809    0.7914
## U[169,1]    0.7905  1.2133   -1.5920   -0.0230    0.7764    1.6000    3.1790
## U[169,2]    0.3943  0.1772    0.0490    0.2745    0.3953    0.5135    0.7408
## U[170,1]   -1.4317  1.2274   -3.8440   -2.2670   -1.4240   -0.6056    0.9645
## U[170,2]   -0.1634  0.1807   -0.5159   -0.2860   -0.1624   -0.0415    0.1902
## U[171,1]   -0.7447  1.2031   -3.1060   -1.5570   -0.7518    0.0755    1.6370
## U[171,2]    0.1868  0.1798   -0.1693    0.0651    0.1883    0.3066    0.5387
## U[172,1]    3.8317  1.2968    1.2950    2.9600    3.8280    4.7000    6.4110
## U[172,2]   -0.0188  0.5166   -1.0030   -0.3693   -0.0266    0.3233    1.0210
## U[173,1]    4.5938  1.4434    1.7220    3.6190    4.6080    5.5652    7.4240
## U[173,2]    0.2247  0.1892   -0.1440    0.0955    0.2246    0.3521    0.5968
## U[174,1]   -5.4617  1.2165   -7.8390   -6.2870   -5.4650   -4.6400   -3.0770
## U[174,2]    1.1264  0.1790    0.7777    1.0040    1.1250    1.2492    1.4780
## U[175,1]    3.0611  1.2949    0.5247    2.1870    3.0640    3.9310    5.6000
## U[175,2]   -0.5090  0.4905   -1.4320   -0.8478   -0.5207   -0.1860    0.4857
## U[176,1]    5.2688  1.2563    2.8070    4.4310    5.2710    6.1180    7.6900
## U[176,2]    0.1453  0.1808   -0.2090    0.0240    0.1437    0.2673    0.4984
## U[177,1]   -1.0349  1.2186   -3.4120   -1.8610   -1.0390   -0.2199    1.3760
## U[177,2]    0.2250  0.1806   -0.1289    0.1051    0.2250    0.3472    0.5765
## U[178,1]    5.6779  1.2221    3.2980    4.8600    5.6790    6.5080    8.0790
## U[178,2]    0.1857  0.1807   -0.1680    0.0632    0.1860    0.3073    0.5402
## U[179,1]    0.1156  1.3125   -2.4710   -0.7606    0.1184    1.0112    2.6720
## U[179,2]    0.0501  0.3215   -0.5693   -0.1676    0.0486    0.2670    0.6862
## U[180,1]    1.7564  1.2152   -0.6481    0.9444    1.7580    2.5720    4.1500
## U[180,2]    0.0004  0.1799   -0.3508   -0.1204    0.0007    0.1217    0.3559
## U[181,1]    0.4457  1.5571   -2.5590   -0.6180    0.4410    1.5150    3.4730
## U[181,2]   -0.3942  0.5440   -1.4120   -0.7684   -0.4112   -0.0374    0.7132
## U[182,1]   -2.7338  1.2103   -5.0940   -3.5450   -2.7330   -1.9190   -0.3638
## U[182,2]   -0.0489  0.1790   -0.3996   -0.1698   -0.0480    0.0732    0.2973
## U[183,1]    2.2770  1.2185   -0.0959    1.4520    2.2750    3.0970    4.6710
## U[183,2]   -0.3318  0.1792   -0.6814   -0.4529   -0.3317   -0.2119    0.0223
## U[184,1]    3.7445  1.2271    1.3550    2.9180    3.7420    4.5740    6.1500
## U[184,2]    0.1586  0.1827   -0.1993    0.0357    0.1591    0.2819    0.5125
## U[185,1]   -3.3279  1.4433   -6.1430   -4.2980   -3.3285   -2.3590   -0.4804
## U[185,2]    0.8167  0.1905    0.4441    0.6882    0.8169    0.9446    1.1870
## U[186,1]    3.8470  1.2178    1.4510    3.0150    3.8560    4.6740    6.2271
## U[186,2]    0.1816  0.1796   -0.1734    0.0600    0.1815    0.3031    0.5343
## U[187,1]    6.8405  1.2178    4.4030    6.0310    6.8480    7.6660    9.2150
## U[187,2]    0.4170  0.1803    0.0677    0.2949    0.4162    0.5369    0.7752
## U[188,1]   -4.7251  1.2152   -7.0661   -5.5550   -4.7340   -3.9050   -2.3480
## U[188,2]    1.2935  0.1807    0.9399    1.1710    1.2940    1.4150    1.6490
## U[189,1]   11.4249  1.5976    8.3100   10.3400   11.4400   12.4900   14.5700
## U[189,2]   -0.0903  0.6267   -1.3220   -0.5145   -0.0880    0.3325    1.1400
## U[190,1]   -1.8124  1.2318   -4.2200   -2.6390   -1.8140   -0.9932    0.6152
## U[190,2]    0.1443  0.1804   -0.2116    0.0242    0.1435    0.2657    0.4955
## U[191,1]    7.7105  1.3317    5.0719    6.8217    7.7240    8.6100   10.3100
## U[191,2]    0.1417  0.1789   -0.2066    0.0213    0.1406    0.2631    0.4928
## U[192,1]   -0.9098  1.2480   -3.3520   -1.7530   -0.9104   -0.0674    1.5540
## U[192,2]    0.2378  0.1806   -0.1144    0.1161    0.2378    0.3602    0.5919
## U[193,1]    1.0193  1.3049   -1.5620    0.1411    1.0170    1.9040    3.5620
## U[193,2]    0.6009  0.3296   -0.0465    0.3799    0.6050    0.8228    1.2440
## U[194,1]   -2.5681  1.2218   -4.9590   -3.3980   -2.5700   -1.7510   -0.1362
## U[194,2]    0.3543  0.1799    0.0005    0.2330    0.3538    0.4758    0.7044
## U[195,1]    2.8518  1.2204    0.4665    2.0180    2.8530    3.6820    5.2330
## U[195,2]   -0.0194  0.1823   -0.3786   -0.1411   -0.0189    0.1036    0.3389
## U[196,1]   -1.3367  1.5739   -4.4110   -2.3980   -1.3470   -0.2772    1.7350
## U[196,2]   -0.4346  0.5617   -1.4970   -0.8240   -0.4457   -0.0589    0.6961
## U[197,1]    0.8769  1.5723   -2.2050   -0.1834    0.8741    1.9360    3.9330
## U[197,2]   -0.0047  0.6218   -1.2210   -0.4202   -0.0094    0.4151    1.2150
## U[198,1]    3.7369  1.2193    1.3620    2.9080    3.7350    4.5580    6.1410
## U[198,2]    0.3409  0.1804   -0.0116    0.2193    0.3418    0.4619    0.6957
## U[199,1]    4.0362  1.2110    1.6590    3.2230    4.0210    4.8440    6.4250
## U[199,2]    0.2580  0.1792   -0.0941    0.1371    0.2580    0.3803    0.6079
## U[200,1]   -1.9794  1.2226   -4.3780   -2.8040   -1.9810   -1.1600    0.4148
## U[200,2]    0.0348  0.1781   -0.3120   -0.0868    0.0350    0.1556    0.3873
## U[201,1]   -3.5676  1.2834   -6.1060   -4.4310   -3.5670   -2.7097   -1.0510
## U[201,2]   -0.1966  0.4442   -1.0380   -0.4967   -0.2084    0.0917    0.7143
## U[202,1]    1.3990  1.6498   -1.8970    0.2882    1.4090    2.5260    4.6280
## U[202,2]   -0.4241  0.5544   -1.4630   -0.8069   -0.4392   -0.0583    0.7138
## U[203,1]   -2.3894  1.3911   -5.1220   -3.3280   -2.3950   -1.4558    0.3243
## U[203,2]    0.0916  0.3099   -0.5132   -0.1188    0.0915    0.3024    0.7014
## U[204,1]   -0.1870  1.5965   -3.3430   -1.2490   -0.1810    0.8714    2.9700
## U[204,2]    0.3876  0.3251   -0.2479    0.1668    0.3887    0.6076    1.0210
## U[205,1]   -2.5820  1.2996   -5.1330   -3.4580   -2.5820   -1.7050   -0.0071
## U[205,2]   -0.1861  0.4821   -1.0940   -0.5179   -0.2025    0.1344    0.7987
## U[206,1]    0.8709  1.2064   -1.4830    0.0502    0.8778    1.6800    3.2450
## U[206,2]   -0.3019  0.1786   -0.6566   -0.4212   -0.3021   -0.1815    0.0464
## U[207,1]   -0.7751  1.5656   -3.8390   -1.8340   -0.7737    0.2804    2.2860
## U[207,2]   -0.2788  0.5182   -1.2460   -0.6388   -0.2937    0.0611    0.7804
## U[208,1]   -3.1000  1.2047   -5.4770   -3.9060   -3.1010   -2.2760   -0.7781
## U[208,2]    0.2918  0.1784   -0.0566    0.1709    0.2914    0.4140    0.6393
## U[209,1]    0.7335  1.1374   -1.5150   -0.0263    0.7365    1.5040    2.9390
## U[209,2]    0.2162  0.1219   -0.0230    0.1340    0.2177    0.2982    0.4547
## U[210,1]    2.2776  1.2116   -0.1087    1.4670    2.2875    3.1000    4.6230
## U[210,2]    0.3782  0.1805    0.0270    0.2557    0.3767    0.5007    0.7328
## U[211,1]   -1.6019  1.2860   -4.1030   -2.4690   -1.5960   -0.7350    0.9129
## U[211,2]   -0.3643  0.5123   -1.3410   -0.7138   -0.3721   -0.0226    0.6641
## U[212,1]    6.4530  1.2019    4.1110    5.6347    6.4455    7.2680    8.8200
## U[212,2]    0.4082  0.1791    0.0570    0.2873    0.4082    0.5283    0.7609
## U[213,1]    1.4884  1.2928   -1.0540    0.6212    1.4900    2.3510    4.0020
## U[213,2]   -0.4162  0.3138   -1.0300   -0.6280   -0.4198   -0.2062    0.2098
## U[214,1]    1.4306  1.2883   -1.0800    0.5519    1.4230    2.2923    3.9540
## U[214,2]   -0.4968  0.4694   -1.3840   -0.8188   -0.5088   -0.1834    0.4511
## U[215,1]    2.4535  1.2092    0.0685    1.6430    2.4650    3.2710    4.7830
## U[215,2]    0.1301  0.1807   -0.2228    0.0082    0.1291    0.2515    0.4872
## U[216,1]    3.2023  1.2106    0.8396    2.3920    3.2010    4.0200    5.5670
## U[216,2]   -0.2582  0.1804   -0.6134   -0.3796   -0.2578   -0.1361    0.0929
## U[217,1]    5.5653  1.5058    2.6060    4.5550    5.5700    6.5830    8.5080
## U[217,2]   -0.6132  0.3253   -1.2460   -0.8325   -0.6151   -0.3939    0.0248
## U[218,1]   -2.0830  1.3111   -4.6560   -2.9610   -2.0790   -1.1990    0.4724
## U[218,2]    0.1089  0.4663   -0.7697   -0.2124    0.0970    0.4162    1.0570
## U[219,1]    9.3004  1.1588    7.0200    8.5130    9.3025   10.0800   11.5700
## U[219,2]   -0.1733  0.1201   -0.4063   -0.2550   -0.1732   -0.0916    0.0636
## U[220,1]   -1.6750  1.3134   -4.2540   -2.5560   -1.6750   -0.7922    0.8941
## U[220,2]    0.2159  0.4811   -0.6966   -0.1162    0.2052    0.5356    1.2020
## U[221,1]   -2.1067  1.2878   -4.6150   -2.9760   -2.1040   -1.2340    0.4063
## U[221,2]    0.1412  0.3152   -0.4674   -0.0723    0.1390    0.3541    0.7626
## U[222,1]   -0.2573  1.1494   -2.5320   -1.0230   -0.2464    0.5104    1.9940
## U[222,2]    0.1266  0.1267   -0.1234    0.0414    0.1274    0.2117    0.3736
## U[223,1]    2.8566  1.2711    0.3470    2.0030    2.8520    3.7110    5.3680
## U[223,2]    0.2392  0.1832   -0.1245    0.1174    0.2398    0.3617    0.5983
## U[224,1]   -6.7997  1.2156   -9.1710   -7.6220   -6.7950   -5.9830   -4.4010
## U[224,2]    0.1301  0.1801   -0.2238    0.0087    0.1314    0.2512    0.4801
## U[225,1]   -6.4842  1.2955   -9.0430   -7.3540   -6.4830   -5.6160   -3.9600
## U[225,2]   -0.0479  0.3185   -0.6700   -0.2621   -0.0484    0.1662    0.5749
## U[226,1]   -1.3053  1.4017   -4.0390   -2.2620   -1.3130   -0.3600    1.4550
## U[226,2]    0.0628  0.3085   -0.5419   -0.1461    0.0634    0.2718    0.6620
## U[227,1]   -2.1470  1.5650   -5.1820   -3.2070   -2.1430   -1.0960    0.9299
## U[227,2]   -0.0211  0.4785   -0.9097   -0.3508   -0.0386    0.2926    0.9659
## U[228,1]   -3.0725  1.2880   -5.5980   -3.9350   -3.0720   -2.2040   -0.5382
## U[228,2]    0.3022  0.4860   -0.6173   -0.0286    0.2890    0.6206    1.3020
## U[229,1]   -2.0695  1.5829   -5.1340   -3.1370   -2.0780   -0.9953    1.0340
## U[229,2]   -0.4130  0.5613   -1.4700   -0.7976   -0.4306   -0.0419    0.7300
## U[230,1]   -1.9332  1.5728   -4.9930   -2.9922   -1.9400   -0.8761    1.1380
## U[230,2]   -0.3872  0.5506   -1.4220   -0.7669   -0.4028   -0.0229    0.7347
## U[231,1]   -2.4298  1.4541   -5.3040   -3.4060   -2.4250   -1.4507    0.4130
## U[231,2]    0.3788  0.1910    0.0053    0.2502    0.3779    0.5084    0.7506
## U[232,1]   -2.3351  1.2254   -4.7560   -3.1560   -2.3370   -1.5160    0.0920
## U[232,2]    0.2872  0.1799   -0.0651    0.1672    0.2869    0.4087    0.6392
## U[233,1]    1.1059  1.2943   -1.4210    0.2396    1.1090    1.9670    3.6290
## U[233,2]   -0.2217  0.4595   -1.0910   -0.5391   -0.2364    0.0819    0.7188
## U[234,1]    1.3239  1.2214   -1.0740    0.4986    1.3250    2.1380    3.7030
## U[234,2]   -0.0203  0.1808   -0.3701   -0.1428   -0.0211    0.1011    0.3379
## U[235,1]   -2.8934  1.2940   -5.4200   -3.7572   -2.8950   -2.0220   -0.3563
## U[235,2]    0.1322  0.4465   -0.7143   -0.1735    0.1212    0.4257    1.0330
## U[236,1]    2.8519  1.2271    0.4202    2.0230    2.8510    3.6710    5.2630
## U[236,2]   -0.1322  0.1807   -0.4889   -0.2527   -0.1324   -0.0109    0.2224
## U[237,1]   -2.2717  1.2812   -4.8050   -3.1322   -2.2740   -1.4050    0.2369
## U[237,2]   -0.0159  0.4512   -0.8655   -0.3260   -0.0318    0.2794    0.9115
## U[238,1]    0.2140  1.2239   -2.1880   -0.6117    0.2219    1.0370    2.6230
## U[238,2]    0.0775  0.1804   -0.2761   -0.0446    0.0771    0.1987    0.4294
## U[239,1]    3.3986  1.4482    0.5519    2.4238    3.4030    4.3820    6.2220
## U[239,2]    0.3098  0.1901   -0.0606    0.1808    0.3090    0.4389    0.6836
## U[240,1]   -3.5225  1.2171   -5.9111   -4.3410   -3.5195   -2.7070   -1.1300
## U[240,2]   -0.1005  0.1789   -0.4530   -0.2211   -0.1002    0.0204    0.2508
## U[241,1]   -2.9608  1.2101   -5.3040   -3.7650   -2.9800   -2.1500   -0.5625
## U[241,2]    0.1847  0.1798   -0.1644    0.0640    0.1850    0.3064    0.5386
## U[242,1]    4.2406  1.4332    1.4400    3.2580    4.2400    5.2100    7.0730
## U[242,2]   -0.3166  0.1887   -0.6882   -0.4446   -0.3165   -0.1883    0.0521
## U[243,1]    1.3711  1.3066   -1.1820    0.4966    1.3725    2.2490    3.9160
## U[243,2]   -0.1350  0.5133   -1.1200   -0.4856   -0.1463    0.2054    0.9022
## U[244,1]   -0.2628  1.2918   -2.7930   -1.1270   -0.2603    0.6024    2.2930
## U[244,2]   -0.0398  0.3116   -0.6566   -0.2509   -0.0382    0.1699    0.5699
## U[245,1]    2.5042  1.2130    0.1300    1.6870    2.5050    3.3190    4.8860
## U[245,2]    0.2859  0.1811   -0.0705    0.1641    0.2872    0.4090    0.6377
## U[246,1]    0.4518  1.2933   -2.0740   -0.4196    0.4524    1.3250    3.0070
## U[246,2]    0.0396  0.3271   -0.6002   -0.1807    0.0383    0.2617    0.6790
## U[247,1]   -1.7859  1.5556   -4.8590   -2.8362   -1.7850   -0.7426    1.2420
## U[247,2]    0.0606  0.4632   -0.7959   -0.2648    0.0399    0.3637    1.0240
## U[248,1]   -1.0411  1.5742   -4.1110   -2.1030   -1.0410    0.0206    2.0200
## U[248,2]    0.1022  0.5849   -1.0170   -0.2952    0.0912    0.4905    1.2800
## U[249,1]    2.0023  1.2981   -0.5698    1.1340    2.0040    2.8770    4.5380
## U[249,2]   -0.5504  0.3152   -1.1610   -0.7639   -0.5524   -0.3399    0.0747
## U[250,1]    1.6741  1.3989   -1.0670    0.7299    1.6690    2.6150    4.4220
## U[250,2]   -0.1609  0.5281   -1.1740   -0.5250   -0.1678    0.1913    0.8912
## U[251,1]    1.1803  1.2100   -1.2030    0.3649    1.1890    1.9990    3.5560
## U[251,2]   -0.1204  0.1798   -0.4710   -0.2423   -0.1200    0.0016    0.2305
## U[252,1]    7.0309  1.2164    4.6710    6.2137    7.0320    7.8490    9.4130
## U[252,2]   -0.0260  0.1800   -0.3797   -0.1468   -0.0259    0.0952    0.3279
## U[253,1]   -2.3229  1.2149   -4.6910   -3.1390   -2.3170   -1.5050    0.0634
## U[253,2]    0.1249  0.1795   -0.2269    0.0037    0.1254    0.2456    0.4774
## U[254,1]    3.0359  1.2281    0.6333    2.2040    3.0360    3.8590    5.4660
## U[254,2]   -0.0385  0.1796   -0.3884   -0.1607   -0.0394    0.0817    0.3168
## U[255,1]   -3.7067  1.3207   -6.2860   -4.5950   -3.7130   -2.8140   -1.1110
## U[255,2]    0.2593  0.1787   -0.0916    0.1386    0.2603    0.3795    0.6080
## U[256,1]   -3.7828  1.2119   -6.1371   -4.6060   -3.7900   -2.9710   -1.3860
## U[256,2]    0.2031  0.1798   -0.1483    0.0820    0.2034    0.3254    0.5519
## U[257,1]   -1.8048  1.2242   -4.1870   -2.6260   -1.8080   -0.9861    0.5933
## U[257,2]    0.2031  0.1806   -0.1510    0.0823    0.2037    0.3240    0.5570
## U[258,1]    7.1446  1.2733    4.6559    6.2800    7.1380    8.0100    9.6360
## U[258,2]   -0.0309  0.1203   -0.2654   -0.1125   -0.0310    0.0496    0.2077
## U[259,1]   -3.2136  1.6438   -6.4390   -4.3140   -3.2120   -2.1160    0.0085
## U[259,2]   -0.1393  0.5011   -1.0740   -0.4846   -0.1564    0.1906    0.8840
## U[260,1]   -0.5264  1.1466   -2.7570   -1.2980   -0.5326    0.2454    1.7420
## U[260,2]    0.1895  0.1194   -0.0476    0.1092    0.1908    0.2706    0.4207
## U[261,1]    7.5692  1.3201    4.9510    6.6900    7.5810    8.4570   10.1400
## U[261,2]   -1.0043  0.5327   -2.0250   -1.3710   -1.0100   -0.6464    0.0549
## U[262,1]   -3.1898  1.1982   -5.5400   -4.0140   -3.1880   -2.3790   -0.8538
## U[262,2]    0.1238  0.1794   -0.2275    0.0025    0.1236    0.2432    0.4796
## U[263,1]   -3.7228  1.3289   -6.3160   -4.6180   -3.7260   -2.8380   -1.1090
## U[263,2]    0.2261  0.1786   -0.1289    0.1053    0.2272    0.3463    0.5751
## U[264,1]    5.8866  1.2153    3.5150    5.0640    5.8730    6.7080    8.2980
## U[264,2]    0.1339  0.1814   -0.2230    0.0118    0.1333    0.2562    0.4905
## U[265,1]    2.0066  1.2976   -0.5250    1.1310    2.0115    2.8833    4.5590
## U[265,2]    0.4130  0.3259   -0.2249    0.1931    0.4120    0.6309    1.0570
## U[266,1]   -2.9056  1.2739   -5.4150   -3.7550   -2.8945   -2.0448   -0.4288
## U[266,2]   -0.0497  0.3073   -0.6473   -0.2596   -0.0529    0.1552    0.5622
## U[267,1]   -0.4233  1.2255   -2.8290   -1.2423   -0.4302    0.4009    1.9630
## U[267,2]    0.1443  0.1801   -0.2081    0.0239    0.1436    0.2660    0.4987
## U[268,1]   -2.0880  1.3340   -4.6870   -2.9810   -2.0850   -1.1880    0.5084
## U[268,2]    0.0830  0.1790   -0.2676   -0.0371    0.0833    0.2027    0.4364
## U[269,1]   -7.7184  1.2207  -10.1200   -8.5370   -7.7250   -6.8970   -5.3200
## U[269,2]    0.0834  0.1820   -0.2756   -0.0387    0.0839    0.2053    0.4415
## U[270,1]   -2.1477  1.3113   -4.7040   -3.0340   -2.1520   -1.2548    0.4348
## U[270,2]   -0.0110  0.3173   -0.6306   -0.2258   -0.0121    0.2038    0.6147
## U[271,1]   -1.7526  1.2893   -4.2930   -2.6080   -1.7550   -0.8853    0.7773
## U[271,2]   -0.0289  0.3173   -0.6503   -0.2438   -0.0297    0.1856    0.5987
## U[272,1]   -6.4771  1.2738   -8.9620   -7.3340   -6.4800   -5.6140   -3.9770
## U[272,2]    0.0978  0.1824   -0.2637   -0.0240    0.0973    0.2201    0.4546
## U[273,1]   -2.7348  1.2202   -5.1390   -3.5570   -2.7390   -1.9067   -0.3355
## U[273,2]   -0.2490  0.1819   -0.6073   -0.3713   -0.2507   -0.1264    0.1080
## U[274,1]    1.0826  1.1475   -1.1580    0.3042    1.0800    1.8660    3.3450
## U[274,2]    0.0769  0.1228   -0.1618   -0.0066    0.0767    0.1596    0.3179
## U[275,1]   -1.2976  1.3463   -3.9480   -2.2050   -1.2870   -0.3931    1.3380
## U[275,2]    0.0901  0.1299   -0.1633    0.0019    0.0897    0.1784    0.3437
## U[276,1]   -2.5360  1.2149   -4.9440   -3.3450   -2.5290   -1.7240   -0.1840
## U[276,2]    0.0169  0.1797   -0.3366   -0.1053    0.0167    0.1380    0.3710
## U[277,1]   -2.1039  1.5613   -5.1570   -3.1400   -2.1020   -1.0587    0.9423
## U[277,2]   -0.1906  0.5029   -1.1240   -0.5434   -0.2042    0.1407    0.8350
## U[278,1]   -6.3931  1.2938   -8.9070   -7.2750   -6.4000   -5.5120   -3.8650
## U[278,2]   -0.0100  0.3201   -0.6404   -0.2253   -0.0107    0.2040    0.6230
## U[279,1]   -2.3034  1.2194   -4.6880   -3.1260   -2.3070   -1.4868    0.0897
## U[279,2]    0.2106  0.1831   -0.1478    0.0875    0.2101    0.3348    0.5678
## U[280,1]   -1.8440  1.4905   -4.7720   -2.8530   -1.8380   -0.8300    1.0440
## U[280,2]   -0.0234  0.3199   -0.6439   -0.2416   -0.0257    0.1921    0.6083
## U[281,1]   -2.2964  1.2147   -4.6890   -3.1060   -2.2900   -1.4860    0.0933
## U[281,2]    0.1887  0.1783   -0.1634    0.0690    0.1881    0.3074    0.5380
## U[282,1]   -2.0597  1.2879   -4.6130   -2.9280   -2.0540   -1.1880    0.4595
## U[282,2]   -0.2315  0.3132   -0.8342   -0.4453   -0.2338   -0.0208    0.3831
## U[283,1]   -2.0979  1.2181   -4.5080   -2.9030   -2.0960   -1.2910    0.2975
## U[283,2]    0.0294  0.1801   -0.3260   -0.0910    0.0296    0.1489    0.3860
## U[284,1]    0.2282  1.1924   -2.1300   -0.5724    0.2407    1.0340    2.5500
## U[284,2]    0.0854  0.1777   -0.2622   -0.0344    0.0869    0.2048    0.4328
## U[285,1]   -0.5687  1.2987   -3.1030   -1.4460   -0.5727    0.3029    1.9760
## U[285,2]    0.0940  0.4582   -0.7734   -0.2189    0.0826    0.3949    1.0170
## U[286,1]    0.6985  1.3026   -1.8640   -0.1763    0.7006    1.5700    3.2651
## U[286,2]   -0.3158  0.5008   -1.2630   -0.6618   -0.3316    0.0201    0.6998
## U[287,1]   -0.3168  1.2834   -2.8390   -1.1923   -0.3160    0.5563    2.1990
## U[287,2]   -0.6016  0.4947   -1.5350   -0.9390   -0.6163   -0.2754    0.4054
## U[288,1]   -1.9492  1.5662   -5.0190   -3.0180   -1.9460   -0.8813    1.1070
## U[288,2]   -0.3320  0.5364   -1.3370   -0.7038   -0.3512    0.0195    0.7721
## U[289,1]    2.6333  1.2186    0.2635    1.8120    2.6300    3.4552    5.0240
## U[289,2]   -0.2212  0.1818   -0.5780   -0.3425   -0.2205   -0.0987    0.1335
## U[290,1]    1.2222  1.2086   -1.1560    0.4089    1.2260    2.0360    3.6130
## U[290,2]    0.4180  0.1783    0.0675    0.2977    0.4181    0.5373    0.7691
## U[291,1]   -2.0792  1.5546   -5.0941   -3.1300   -2.0920   -1.0390    1.0120
## U[291,2]    0.1760  0.1892   -0.1944    0.0488    0.1766    0.3038    0.5443
## U[292,1]   -3.8106  1.6484   -7.0420   -4.9290   -3.8060   -2.6910   -0.5685
## U[292,2]   -0.3796  0.5564   -1.4300   -0.7624   -0.3926   -0.0108    0.7474
## U[293,1]    0.5322  1.2295   -1.8570   -0.2995    0.5229    1.3563    2.9450
## U[293,2]    0.0835  0.1796   -0.2716   -0.0363    0.0829    0.2035    0.4361
## U[294,1]   -2.8734  1.2280   -5.2390   -3.7080   -2.8750   -2.0490   -0.4614
## U[294,2]   -0.0645  0.1815   -0.4197   -0.1863   -0.0634    0.0588    0.2867
## U[295,1]   -0.8959  1.2186   -3.3080   -1.7280   -0.8966   -0.0636    1.4910
## U[295,2]    0.3776  0.1781    0.0260    0.2586    0.3769    0.4976    0.7271
## U[296,1]    0.0236  1.2801   -2.4931   -0.8309    0.0318    0.8785    2.5410
## U[296,2]   -0.1492  0.3146   -0.7629   -0.3622   -0.1494    0.0640    0.4691
## U[297,1]   -0.2249  1.2909   -2.7460   -1.0910   -0.2269    0.6538    2.3000
## U[297,2]   -0.1829  0.3198   -0.8058   -0.4009   -0.1842    0.0336    0.4474
## U[298,1]   -1.8934  1.3001   -4.4250   -2.7730   -1.8910   -1.0080    0.6514
## U[298,2]    0.0592  0.3160   -0.5549   -0.1545    0.0563    0.2698    0.6843
## U[299,1]    2.6519  1.2923    0.1156    1.7870    2.6550    3.5170    5.1580
## U[299,2]   -0.1645  0.3224   -0.7918   -0.3829   -0.1678    0.0551    0.4739
## U[300,1]   -1.6747  1.3022   -4.2320   -2.5532   -1.6710   -0.7957    0.8772
## U[300,2]    0.0626  0.4759   -0.8321   -0.2649    0.0471    0.3770    1.0370
## U[301,1]    0.4288  1.2106   -1.9930   -0.3739    0.4352    1.2430    2.7850
## U[301,2]    0.0194  0.1792   -0.3316   -0.1019    0.0182    0.1396    0.3742
## U[302,1]    3.5571  1.2200    1.1730    2.7240    3.5495    4.3930    5.9500
## U[302,2]    0.0916  0.1798   -0.2617   -0.0315    0.0928    0.2139    0.4414
## U[303,1]    2.7132  1.2802    0.2063    1.8500    2.7135    3.5710    5.2200
## U[303,2]   -0.1797  0.3199   -0.7983   -0.3945   -0.1825    0.0350    0.4525
## U[304,1]   -2.0948  1.2040   -4.4700   -2.9013   -2.0910   -1.2790    0.2562
## U[304,2]    0.2351  0.1811   -0.1194    0.1139    0.2365    0.3566    0.5891
## U[305,1]   -2.9786  1.5757   -6.0830   -4.0290   -2.9815   -1.9100    0.0912
## U[305,2]    0.2604  0.3190   -0.3632    0.0443    0.2610    0.4748    0.8892
## U[306,1]    0.1246  1.4291   -2.7140   -0.8237    0.1371    1.0740    2.9032
## U[306,2]   -0.0653  0.1885   -0.4368   -0.1916   -0.0645    0.0608    0.3050
## U[307,1]   -2.2787  1.2232   -4.6800   -3.1030   -2.2870   -1.4507    0.1204
## U[307,2]   -0.1210  0.1806   -0.4725   -0.2408   -0.1215   -0.0006    0.2355
## U[308,1]   -2.5540  1.2802   -5.0511   -3.4130   -2.5560   -1.6940   -0.0354
## U[308,2]    0.0805  0.3156   -0.5348   -0.1326    0.0805    0.2914    0.7036
## U[309,1]    4.2498  1.2177    1.8810    3.4260    4.2520    5.0650    6.6610
## U[309,2]   -0.2020  0.1807   -0.5554   -0.3243   -0.2017   -0.0810    0.1536
## U[310,1]   -2.6219  1.2904   -5.1810   -3.4870   -2.6210   -1.7530   -0.1127
## U[310,2]    0.0504  0.3161   -0.5661   -0.1622    0.0483    0.2621    0.6757
## U[311,1]    0.6625  1.2639   -1.8140   -0.1891    0.6678    1.5220    3.1420
## U[311,2]   -0.2896  0.1802   -0.6398   -0.4112   -0.2902   -0.1678    0.0635
## U[312,1]    3.7399  1.3216    1.1620    2.8520    3.7420    4.6360    6.3070
## U[312,2]   -0.4608  0.1803   -0.8181   -0.5805   -0.4611   -0.3392   -0.1066
## U[313,1]    6.5120  1.1501    4.2440    5.7400    6.5090    7.2900    8.7660
## U[313,2]    0.3063  0.1202    0.0703    0.2250    0.3056    0.3868    0.5429
## U[314,1]   -1.7752  1.3030   -4.3180   -2.6570   -1.7670   -0.8975    0.7703
## U[314,2]   -0.2606  0.4974   -1.2050   -0.6018   -0.2710    0.0700    0.7415
## U[315,1]   -1.6027  1.1349   -3.8510   -2.3620   -1.6020   -0.8461    0.6121
## U[315,2]    0.1996  0.1218   -0.0393    0.1167    0.1996    0.2814    0.4389
## U[316,1]   -3.1139  1.1478   -5.3480   -3.8800   -3.1200   -2.3470   -0.8605
## U[316,2]    0.2391  0.1217   -0.0003    0.1568    0.2393    0.3211    0.4749
## U[317,1]   -2.3792  1.2817   -4.8940   -3.2450   -2.3800   -1.5140    0.1334
## U[317,2]    0.0903  0.3099   -0.5141   -0.1180    0.0880    0.2962    0.7034
## U[318,1]    7.9290  1.1462    5.6740    7.1610    7.9330    8.7000   10.1800
## U[318,2]   -0.3057  0.1226   -0.5455   -0.3887   -0.3062   -0.2233   -0.0620
## U[319,1]    5.3777  1.2319    2.9500    4.5470    5.3695    6.2000    7.8160
## U[319,2]    0.3022  0.1809   -0.0554    0.1801    0.3039    0.4237    0.6533
## U[320,1]   -3.1952  1.5749   -6.2700   -4.2570   -3.1950   -2.1280   -0.0722
## U[320,2]    0.1807  0.5658   -0.8914   -0.2097    0.1695    0.5565    1.3270
## U[321,1]   -2.4106  1.5665   -5.4860   -3.4690   -2.4180   -1.3560    0.6652
## U[321,2]   -0.2462  0.5146   -1.2070   -0.5999   -0.2600    0.0916    0.8075
## U[322,1]   -2.4962  1.5741   -5.5950   -3.5580   -2.5060   -1.4320    0.5723
## U[322,2]   -0.4975  0.5874   -1.6160   -0.8973   -0.5082   -0.1064    0.6912
## U[323,1]   -3.4258  1.2272   -5.8390   -4.2560   -3.4310   -2.6040   -1.0070
## U[323,2]    0.2173  0.1807   -0.1382    0.0961    0.2164    0.3387    0.5752
## U[324,1]   -1.7871  1.2858   -4.3170   -2.6530   -1.7850   -0.9182    0.7352
## U[324,2]   -0.1036  0.3150   -0.7191   -0.3154   -0.1047    0.1065    0.5204
## U[325,1]    0.2723  1.2045   -2.0940   -0.5347    0.2750    1.0840    2.6450
## U[325,2]   -0.0861  0.1780   -0.4376   -0.2056   -0.0859    0.0327    0.2650
## U[326,1]   -2.7811  1.2840   -5.2760   -3.6450   -2.7860   -1.9110   -0.2606
## U[326,2]   -0.0467  0.3121   -0.6507   -0.2594   -0.0479    0.1632    0.5678
## U[327,1]   -0.1267  1.4294   -2.9150   -1.1022   -0.1247    0.8457    2.6740
## U[327,2]   -0.3450  0.1900   -0.7161   -0.4716   -0.3454   -0.2174    0.0256
## U[328,1]   -2.8414  1.2908   -5.3810   -3.7090   -2.8410   -1.9628   -0.3291
## U[328,2]   -0.5675  0.5122   -1.5400   -0.9189   -0.5802   -0.2285    0.4632
## U[329,1]   -3.6594  1.5511   -6.7190   -4.7070   -3.6540   -2.6030   -0.6564
## U[329,2]   -0.3023  0.5344   -1.3040   -0.6710   -0.3185    0.0474    0.7855
## U[330,1]    1.7778  1.2078   -0.5791    0.9618    1.7770    2.5880    4.1610
## U[330,2]    0.1987  0.1788   -0.1556    0.0788    0.1991    0.3187    0.5505
## U[331,1]   -0.5549  1.2742   -3.0330   -1.4230   -0.5606    0.3027    1.9670
## U[331,2]    0.2624  0.3169   -0.3590    0.0488    0.2618    0.4749    0.8882
## U[332,1]   -5.2062  1.4588   -8.0900   -6.1870   -5.2020   -4.2240   -2.3460
## U[332,2]    0.0214  0.1919   -0.3543   -0.1074    0.0214    0.1497    0.4011
## U[333,1]    1.4176  1.3079   -1.1680    0.5392    1.4130    2.2992    3.9830
## U[333,2]    0.2663  0.5113   -0.7142   -0.0814    0.2630    0.6039    1.2890
## U[334,1]   -2.8983  1.3035   -5.4570   -3.7730   -2.8950   -2.0200   -0.3539
## U[334,2]    0.0348  0.3176   -0.5818   -0.1773    0.0341    0.2483    0.6648
## U[335,1]   -1.6345  1.2831   -4.1630   -2.4920   -1.6310   -0.7787    0.8899
## U[335,2]    0.0321  0.3183   -0.5912   -0.1824    0.0338    0.2462    0.6570
## U[336,1]    2.2629  1.4188   -0.5153    1.2990    2.2610    3.2190    5.0400
## U[336,2]   -0.6657  0.3272   -1.3030   -0.8866   -0.6694   -0.4449   -0.0251
## U[337,1]   -2.1596  1.6349   -5.3660   -3.2682   -2.1570   -1.0710    1.0560
## U[337,2]   -0.4081  0.5592   -1.4550   -0.7956   -0.4250   -0.0388    0.7487
## U[338,1]   -2.1275  1.2194   -4.5380   -2.9462   -2.1240   -1.2970    0.2312
## U[338,2]    0.1680  0.1790   -0.1848    0.0473    0.1684    0.2897    0.5174
## U[339,1]   -4.1161  1.3402   -6.7290   -5.0220   -4.1190   -3.2097   -1.5070
## U[339,2]    0.0653  0.1812   -0.2884   -0.0567    0.0651    0.1861    0.4228
## U[340,1]    4.9050  1.3463    2.2680    3.9940    4.8930    5.8130    7.5400
## U[340,2]   -0.0328  0.1823   -0.3874   -0.1569   -0.0342    0.0895    0.3306
## U[341,1]    0.5608  1.3122   -1.9951   -0.3300    0.5568    1.4440    3.1560
## U[341,2]    0.2936  0.1805   -0.0623    0.1735    0.2949    0.4154    0.6450
## U[342,1]    2.1832  1.2362   -0.2275    1.3590    2.1800    3.0100    4.6190
## U[342,2]   -0.0121  0.1798   -0.3651   -0.1339   -0.0127    0.1108    0.3376
## U[343,1]    2.5721  1.3634   -0.1023    1.6540    2.5740    3.4880    5.2490
## U[343,2]   -0.3404  0.1804   -0.6932   -0.4618   -0.3415   -0.2194    0.0134
## U[344,1]   -3.2634  1.5888   -6.3570   -4.3330   -3.2610   -2.1850   -0.1419
## U[344,2]   -0.4606  0.5768   -1.5610   -0.8561   -0.4738   -0.0788    0.7063
## U[345,1]   -0.0943  1.3063   -2.6260   -0.9845   -0.0918    0.7861    2.4610
## U[345,2]    0.1109  0.3249   -0.5208   -0.1082    0.1106    0.3284    0.7570
## U[346,1]    9.9919  1.2172    7.5930    9.1777    9.9940   10.8200   12.3600
## U[346,2]   -0.2650  0.1808   -0.6180   -0.3872   -0.2654   -0.1437    0.0890
## U[347,1]    2.1122  1.2185   -0.2561    1.2810    2.1120    2.9380    4.5270
## U[347,2]   -0.1096  0.1806   -0.4632   -0.2309   -0.1105    0.0123    0.2439
## U[348,1]    9.8723  1.3007    7.3250    8.9970    9.8770   10.7400   12.4100
## U[348,2]    0.1936  0.3311   -0.4559   -0.0317    0.1941    0.4162    0.8445
## U[349,1]   -1.4272  1.2887   -3.9480   -2.2970   -1.4350   -0.5557    1.0880
## U[349,2]    0.0792  0.4673   -0.7930   -0.2425    0.0658    0.3879    1.0310
## U[350,1]    7.2134  1.2271    4.7930    6.3880    7.2150    8.0420    9.6100
## U[350,2]    0.1997  0.1798   -0.1522    0.0776    0.2008    0.3201    0.5532
## U[351,1]   -4.1677  1.3202   -6.7380   -5.0540   -4.1750   -3.2798   -1.5830
## U[351,2]    0.0524  0.1779   -0.2974   -0.0679    0.0530    0.1723    0.3998
## U[352,1]   -2.7004  1.5753   -5.7680   -3.7710   -2.7075   -1.6290    0.3883
## U[352,2]    0.3405  0.5288   -0.6380   -0.0247    0.3272    0.6896    1.4120
## U[353,1]    9.6032  1.2247    7.2209    8.7827    9.6020   10.4300   11.9900
## U[353,2]    0.1546  0.1802   -0.1976    0.0313    0.1562    0.2760    0.5043
## U[354,1]   -5.7754  1.2980   -8.3400   -6.6460   -5.7800   -4.9040   -3.2370
## U[354,2]   -0.2688  0.5080   -1.2290   -0.6171   -0.2823    0.0720    0.7639
## U[355,1]    6.2066  1.6560    3.0000    5.0810    6.2130    7.3143    9.5010
## U[355,2]   -0.6797  0.6290   -1.9030   -1.1060   -0.6876   -0.2553    0.5623
## U[356,1]   -2.5102  1.2802   -5.0000   -3.3830   -2.5060   -1.6470    0.0048
## U[356,2]   -0.1798  0.4838   -1.0900   -0.5141   -0.1921    0.1415    0.7987
## U[357,1]   -1.7630  1.2179   -4.1590   -2.5800   -1.7580   -0.9410    0.6020
## U[357,2]    0.0099  0.1800   -0.3417   -0.1111    0.0096    0.1312    0.3655
## U[358,1]    0.3375  1.3077   -2.2040   -0.5446    0.3333    1.2160    2.9110
## U[358,2]    0.0543  0.5013   -0.8981   -0.2881    0.0416    0.3872    1.0590
## U[359,1]   -0.0693  1.1221   -2.2540   -0.8269   -0.0642    0.6940    2.1200
## U[359,2]    0.0894  0.1210   -0.1483    0.0080    0.0896    0.1709    0.3257
## U[360,1]    2.2486  1.1525   -0.0110    1.4710    2.2555    3.0190    4.5020
## U[360,2]    0.1275  0.1223   -0.1118    0.0448    0.1279    0.2092    0.3696
## U[361,1]   -4.0407  1.4843   -6.9550   -5.0300   -4.0410   -3.0440   -1.1250
## U[361,2]    0.4702  0.3239   -0.1661    0.2517    0.4676    0.6885    1.1050
## U[362,1]   -4.7814  1.5570   -7.8200   -5.8290   -4.7820   -3.7320   -1.7210
## U[362,2]   -0.2080  0.5132   -1.1630   -0.5610   -0.2282    0.1322    0.8514
## U[363,1]   -2.6747  1.3008   -5.2121   -3.5560   -2.6700   -1.8000   -0.1193
## U[363,2]   -0.1880  0.3182   -0.8068   -0.4025   -0.1896    0.0250    0.4375
## U[364,1]   -1.6861  1.5643   -4.7790   -2.7330   -1.6870   -0.6325    1.3941
## U[364,2]   -0.0893  0.1920   -0.4639   -0.2188   -0.0900    0.0392    0.2870
## U[365,1]   -1.0456  1.3109   -3.6310   -1.9320   -1.0520   -0.1594    1.5230
## U[365,2]    0.1755  0.5531   -0.9101   -0.1974    0.1736    0.5481    1.2650
## U[366,1]   -2.3371  1.2690   -4.8640   -3.1910   -2.3335   -1.4740    0.1211
## U[366,2]    0.3717  0.1824    0.0120    0.2482    0.3729    0.4955    0.7285
## U[367,1]   -3.1246  1.3067   -5.6960   -4.0100   -3.1250   -2.2490   -0.5599
## U[367,2]   -0.3329  0.5003   -1.2820   -0.6772   -0.3447   -0.0009    0.6749
## U[368,1]   -0.9304  1.2122   -3.2990   -1.7500   -0.9276   -0.1059    1.4350
## U[368,2]   -0.0916  0.1800   -0.4478   -0.2120   -0.0919    0.0299    0.2605
## U[369,1]   -3.6150  1.2526   -6.0410   -4.4662   -3.6220   -2.7608   -1.1740
## U[369,2]    0.2834  0.1804   -0.0687    0.1609    0.2829    0.4047    0.6371
## U[370,1]   -3.2600  1.2846   -5.7680   -4.1322   -3.2500   -2.4000   -0.7315
## U[370,2]   -0.0579  0.4150   -0.8402   -0.3375   -0.0713    0.2112    0.7857
## U[371,1]   -1.8559  1.4869   -4.7520   -2.8570   -1.8570   -0.8449    1.0760
## U[371,2]    0.0271  0.3232   -0.6055   -0.1932    0.0276    0.2449    0.6621
## U[372,1]    5.5735  1.2100    3.2160    4.7550    5.5720    6.3900    7.9310
## U[372,2]    0.3362  0.1797   -0.0171    0.2142    0.3365    0.4585    0.6873
## U[373,1]   -1.6869  1.3003   -4.2460   -2.5690   -1.6785   -0.8098    0.8258
## U[373,2]   -0.2512  0.5143   -1.2340   -0.5986   -0.2638    0.0925    0.7847
## U[374,1]    5.3978  1.2748    2.8849    4.5470    5.3920    6.2620    7.9170
## U[374,2]    0.4479  0.1825    0.0879    0.3270    0.4483    0.5696    0.8118
## U[375,1]    4.9670  1.5786    1.8640    3.8990    4.9655    6.0260    8.0660
## U[375,2]   -0.5958  0.6030   -1.7650   -1.0090   -0.5989   -0.1915    0.6045
## U[376,1]   -4.8642  1.5582   -7.9370   -5.9200   -4.8680   -3.8170   -1.7920
## U[376,2]   -0.2858  0.5352   -1.2830   -0.6575   -0.3042    0.0674    0.8179
## U[377,1]    3.3021  1.3307    0.7005    2.4057    3.2955    4.1960    5.9290
## U[377,2]    0.7279  0.1796    0.3757    0.6082    0.7281    0.8495    1.0810
## U[378,1]   -3.4252  1.2803   -5.9460   -4.2860   -3.4195   -2.5620   -0.9244
## U[378,2]   -0.2582  0.4473   -1.1070   -0.5624   -0.2680    0.0385    0.6415
## U[379,1]   -1.2494  1.2967   -3.7970   -2.1230   -1.2460   -0.3679    1.2720
## U[379,2]   -0.0131  0.3199   -0.6360   -0.2300   -0.0147    0.2018    0.6196
## U[380,1]   -0.5892  1.2919   -3.1120   -1.4590   -0.5889    0.2862    1.9470
## U[380,2]    0.0343  0.3143   -0.5762   -0.1765    0.0318    0.2453    0.6513
## U[381,1]    3.5478  1.3027    1.0020    2.6630    3.5560    4.4130    6.0990
## U[381,2]   -0.2756  0.3217   -0.9054   -0.4916   -0.2747   -0.0613    0.3630
## U[382,1]    0.7472  1.2908   -1.7900   -0.1281    0.7383    1.6180    3.2790
## U[382,2]    0.2782  0.4942   -0.6677   -0.0608    0.2719    0.6015    1.2780
## U[383,1]   -7.5080  1.2988  -10.0400   -8.3790   -7.5020   -6.6348   -4.9560
## U[383,2]    0.0118  0.3204   -0.6155   -0.2018    0.0086    0.2266    0.6449
## U[384,1]    4.1754  1.3107    1.6010    3.2970    4.1810    5.0590    6.7200
## U[384,2]    0.2439  0.1801   -0.1114    0.1232    0.2441    0.3669    0.5956
## U[385,1]    7.1506  1.2199    4.7550    6.3337    7.1470    7.9712    9.5310
## U[385,2]   -0.4657  0.1804   -0.8165   -0.5887   -0.4661   -0.3451   -0.1089
## U[386,1]    2.5601  1.2920    0.0229    1.6850    2.5630    3.4380    5.0820
## U[386,2]   -0.4466  0.4945   -1.3820   -0.7881   -0.4550   -0.1152    0.5410
## U[387,1]   -0.9925  1.2965   -3.5100   -1.8762   -0.9892   -0.1174    1.5330
## U[387,2]   -0.1478  0.3168   -0.7615   -0.3640   -0.1483    0.0639    0.4773
## U[388,1]   -1.1265  1.2142   -3.5140   -1.9460   -1.1350   -0.3126    1.2560
## U[388,2]    0.1559  0.1807   -0.2004    0.0358    0.1567    0.2767    0.5119
## U[389,1]   -1.6606  1.2954   -4.2330   -2.5260   -1.6610   -0.7919    0.8734
## U[389,2]   -0.4623  0.5096   -1.4360   -0.8120   -0.4703   -0.1250    0.5676
## U[390,1]    8.4122  1.2874    5.9089    7.5400    8.4140    9.2890   10.9600
## U[390,2]   -0.1202  0.3272   -0.7580   -0.3383   -0.1202    0.0966    0.5172
## U[391,1]   -1.3966  1.2420   -3.8390   -2.2360   -1.4010   -0.5618    1.0600
## U[391,2]    0.0714  0.1232   -0.1738   -0.0116    0.0719    0.1549    0.3126
## U[392,1]   -1.1145  1.2998   -3.6760   -1.9920   -1.1090   -0.2381    1.4240
## U[392,2]   -0.5618  0.5215   -1.5750   -0.9155   -0.5633   -0.2109    0.4649
## U[393,1]   -1.4812  1.2853   -4.0000   -2.3470   -1.4860   -0.6120    1.0310
## U[393,2]    0.0440  0.3211   -0.5825   -0.1727    0.0413    0.2572    0.6798
## U[394,1]   -0.4875  1.5806   -3.5590   -1.5540   -0.4942    0.5827    2.6170
## U[394,2]   -0.4341  0.5656   -1.4910   -0.8235   -0.4496   -0.0576    0.7121
## U[395,1]    1.9128  1.2667   -0.5687    1.0600    1.9050    2.7550    4.4030
## U[395,2]   -0.0761  0.1802   -0.4306   -0.1959   -0.0766    0.0449    0.2746
## U[396,1]   -3.3679  1.2832   -5.8900   -4.2360   -3.3590   -2.4940   -0.8824
## U[396,2]    0.3123  0.3164   -0.3032    0.1000    0.3096    0.5231    0.9436
## U[397,1]   -1.4063  1.5900   -4.4880   -2.4840   -1.4170   -0.3350    1.7250
## U[397,2]   -0.3915  0.5493   -1.4280   -0.7703   -0.4076   -0.0317    0.7312
## U[398,1]   -0.3162  1.2907   -2.8530   -1.1930   -0.3214    0.5560    2.2070
## U[398,2]    0.0142  0.3179   -0.6130   -0.2011    0.0147    0.2280    0.6385
## U[399,1]    6.5493  1.2158    4.1750    5.7280    6.5450    7.3600    8.9530
## U[399,2]    0.4418  0.1790    0.0901    0.3208    0.4422    0.5636    0.7882
## U[400,1]   -1.4014  1.2792   -3.8830   -2.2640   -1.4020   -0.5397    1.1150
## U[400,2]   -0.1429  0.3141   -0.7543   -0.3533   -0.1433    0.0667    0.4798
## U[401,1]   -0.1099  1.2985   -2.6430   -0.9928   -0.1184    0.7767    2.4200
## U[401,2]   -0.2349  0.4450   -1.0760   -0.5411   -0.2473    0.0567    0.6656
## U[402,1]   -1.3582  1.2940   -3.9310   -2.2250   -1.3540   -0.4806    1.1590
## U[402,2]    0.0295  0.3148   -0.5855   -0.1832    0.0278    0.2388    0.6518
## U[403,1]    0.7334  1.5845   -2.3980   -0.3396    0.7290    1.8040    3.8330
## U[403,2]    0.0926  0.5777   -1.0100   -0.3009    0.0836    0.4775    1.2490
## U[404,1]   -2.7046  1.2092   -5.0490   -3.5260   -2.7110   -1.8980   -0.3173
## U[404,2]    0.2521  0.1795   -0.0992    0.1315    0.2516    0.3739    0.6044
## U[405,1]   -1.9197  1.2183   -4.3020   -2.7370   -1.9250   -1.1030    0.4578
## U[405,2]    0.1470  0.1792   -0.2058    0.0269    0.1470    0.2682    0.4973
## U[406,1]   -2.9514  1.2826   -5.4860   -3.8080   -2.9360   -2.0860   -0.4352
## U[406,2]    0.0196  0.4730   -0.8694   -0.3046    0.0050    0.3312    0.9879
## U[407,1]   -1.9818  1.2256   -4.3920   -2.8110   -1.9820   -1.1540    0.4423
## U[407,2]   -0.0045  0.1802   -0.3584   -0.1247   -0.0044    0.1174    0.3501
## U[408,1]   -2.6995  1.3005   -5.2410   -3.5680   -2.7050   -1.8180   -0.1734
## U[408,2]   -0.1701  0.4928   -1.1130   -0.5075   -0.1764    0.1561    0.8199
## U[409,1]    1.3955  1.2141   -0.9895    0.5812    1.3940    2.2140    3.8010
## U[409,2]    0.0908  0.1817   -0.2706   -0.0298    0.0915    0.2132    0.4458
## U[410,1]   -3.6221  1.4125   -6.4030   -4.5830   -3.6335   -2.6710   -0.8393
## U[410,2]   -0.2328  0.4899   -1.1580   -0.5695   -0.2441    0.0933    0.7617
## U[411,1]    0.5078  1.2146   -1.8920   -0.3137    0.5173    1.3370    2.8720
## U[411,2]   -0.2411  0.1790   -0.5930   -0.3618   -0.2420   -0.1211    0.1128
## U[412,1]    3.0160  1.2831    0.5032    2.1490    3.0140    3.8780    5.5410
## U[412,2]   -0.0489  0.3201   -0.6724   -0.2636   -0.0468    0.1648    0.5749
## U[413,1]   -0.4640  1.5564   -3.5110   -1.5082   -0.4672    0.5799    2.5840
## U[413,2]   -0.2079  0.5007   -1.1310   -0.5538   -0.2267    0.1189    0.8220
## U[414,1]    4.1823  1.2135    1.8090    3.3630    4.1860    5.0070    6.5300
## U[414,2]   -0.4028  0.1805   -0.7556   -0.5233   -0.4036   -0.2808   -0.0495
## U[415,1]   -3.4511  1.5883   -6.5390   -4.5210   -3.4500   -2.3890   -0.3529
## U[415,2]   -0.4573  0.5761   -1.5370   -0.8614   -0.4668   -0.0718    0.7152
## U[416,1]   -0.3795  1.3014   -2.9170   -1.2500   -0.3793    0.4918    2.1840
## U[416,2]    0.3053  0.3233   -0.3266    0.0890    0.3030    0.5242    0.9424
## U[417,1]   -2.7695  1.3037   -5.3110   -3.6502   -2.7730   -1.8910   -0.1828
## U[417,2]   -0.4109  0.3241   -1.0440   -0.6287   -0.4105   -0.1924    0.2271
## U[418,1]    1.7223  1.5915   -1.3910    0.6461    1.7200    2.7930    4.8200
## U[418,2]   -0.5625  0.5981   -1.7000   -0.9681   -0.5719   -0.1592    0.6382
## U[419,1]    3.3352  1.2293    0.9415    2.5110    3.3240    4.1690    5.7450
## U[419,2]    0.5450  0.1811    0.1854    0.4259    0.5450    0.6664    0.8998
## U[420,1]    6.6062  1.5916    3.4630    5.5287    6.6050    7.6870    9.7070
## U[420,2]    0.0331  0.5867   -1.0820   -0.3684    0.0236    0.4261    1.2140
## U[421,1]   -3.4039  1.2356   -5.7990   -4.2450   -3.4100   -2.5730   -0.9545
## U[421,2]    0.0792  0.1816   -0.2757   -0.0432    0.0790    0.2011    0.4336
## U[422,1]    0.4096  1.2018   -1.9320   -0.3921    0.4033    1.2112    2.7790
## U[422,2]    0.2103  0.1793   -0.1435    0.0889    0.2108    0.3314    0.5600
## U[423,1]    2.4090  1.2307    0.0151    1.5740    2.4010    3.2400    4.8380
## U[423,2]    0.1842  0.1806   -0.1696    0.0624    0.1851    0.3051    0.5360
## U[424,1]   -0.6798  1.2952   -3.2270   -1.5550   -0.6725    0.1988    1.8580
## U[424,2]   -0.2818  0.3272   -0.9206   -0.5037   -0.2812   -0.0630    0.3668
## U[425,1]   -1.2504  1.5707   -4.3050   -2.3050   -1.2570   -0.1932    1.8340
## U[425,2]    0.1055  0.5943   -1.0270   -0.3047    0.0975    0.5019    1.3070
## U[426,1]   -0.4106  1.2959   -2.9400   -1.2893   -0.4139    0.4688    2.1170
## U[426,2]    0.4087  0.5344   -0.6197    0.0416    0.4018    0.7639    1.4720
## U[427,1]    0.0866  1.5730   -3.0050   -0.9766    0.1006    1.1320    3.1760
## U[427,2]   -0.5076  0.5779   -1.6050   -0.9050   -0.5214   -0.1236    0.6601
## U[428,1]   -2.2437  1.2276   -4.6340   -3.0710   -2.2480   -1.4187    0.1668
## U[428,2]    0.2779  0.1790   -0.0747    0.1579    0.2787    0.3980    0.6315
## U[429,1]    0.6545  1.5963   -2.4740   -0.4190    0.6581    1.7180    3.7930
## U[429,2]    0.0037  0.3263   -0.6305   -0.2186    0.0033    0.2237    0.6500
## U[430,1]   -0.0520  1.2242   -2.4090   -0.8840   -0.0595    0.7715    2.3530
## U[430,2]    0.0155  0.1795   -0.3396   -0.1045    0.0174    0.1374    0.3650
## U[431,1]   -3.0080  1.5703   -6.0650   -4.0690   -3.0140   -1.9530    0.0542
## U[431,2]   -0.3402  0.5405   -1.3500   -0.7146   -0.3548    0.0136    0.7590
## U[432,1]   -2.5735  1.2777   -5.0690   -3.4280   -2.5835   -1.7120   -0.0428
## U[432,2]    0.0963  0.4702   -0.7764   -0.2293    0.0808    0.4068    1.0560
## U[433,1]    1.3597  1.2114   -0.9905    0.5413    1.3530    2.1722    3.7410
## U[433,2]   -0.1519  0.1797   -0.5055   -0.2731   -0.1522   -0.0297    0.1991
## U[434,1]    2.6689  1.2275    0.2677    1.8420    2.6680    3.5060    5.0570
## U[434,2]    0.0274  0.1803   -0.3290   -0.0931    0.0275    0.1501    0.3780
## U[435,1]   -1.6158  1.2124   -3.9910   -2.4270   -1.6160   -0.8091    0.7724
## U[435,2]    0.2814  0.1795   -0.0682    0.1593    0.2813    0.4019    0.6360
## U[436,1]    5.8393  1.2087    3.4480    5.0310    5.8430    6.6540    8.1930
## U[436,2]   -0.2289  0.1793   -0.5796   -0.3494   -0.2298   -0.1079    0.1213
## U[437,1]    1.2741  1.2043   -1.0900    0.4593    1.2720    2.0930    3.6360
## U[437,2]    0.4463  0.1802    0.0925    0.3221    0.4449    0.5681    0.8005
## U[438,1]    3.5146  1.3248    0.9188    2.6260    3.5145    4.3890    6.1460
## U[438,2]    0.3019  0.1801   -0.0565    0.1812    0.3028    0.4224    0.6530
## U[439,1]    0.3848  1.2969   -2.1840   -0.4864    0.3968    1.2570    2.9080
## U[439,2]    0.1580  0.3238   -0.4735   -0.0619    0.1575    0.3746    0.7959
## U[440,1]   -1.2966  1.2769   -3.8030   -2.1550   -1.3020   -0.4344    1.2251
## U[440,2]   -0.4288  0.4748   -1.3320   -0.7543   -0.4371   -0.1150    0.5359
## U[441,1]   10.1856  1.2023    7.8250    9.3797   10.1900   11.0000   12.5300
## U[441,2]   -0.0452  0.1798   -0.3978   -0.1678   -0.0455    0.0772    0.3066
## U[442,1]   -5.1397  1.3142   -7.7121   -6.0150   -5.1380   -4.2540   -2.5830
## U[442,2]   -0.1548  0.3271   -0.7941   -0.3770   -0.1564    0.0681    0.4819
## U[443,1]   -6.2996  1.1381   -8.5290   -7.0730   -6.2940   -5.5370   -4.0670
## U[443,2]    0.1576  0.1195   -0.0764    0.0765    0.1577    0.2392    0.3902
## U[444,1]    0.1677  1.2172   -2.2270   -0.6482    0.1623    0.9840    2.5490
## U[444,2]    0.1143  0.1794   -0.2378   -0.0065    0.1149    0.2339    0.4644
## U[445,1]    0.0060  1.2158   -2.3800   -0.8154    0.0032    0.8224    2.3850
## U[445,2]   -0.0364  0.1783   -0.3904   -0.1552   -0.0360    0.0841    0.3092
## U[446,1]   -2.2203  1.2824   -4.7540   -3.0810   -2.2130   -1.3610    0.2895
## U[446,2]    0.3150  0.3175   -0.3036    0.0978    0.3165    0.5268    0.9438
## U[447,1]   -1.6932  1.2955   -4.2500   -2.5600   -1.6830   -0.8141    0.8184
## U[447,2]   -0.3034  0.3249   -0.9339   -0.5254   -0.3034   -0.0849    0.3375
## U[448,1]    5.0898  1.3060    2.5390    4.2030    5.0880    5.9660    7.6420
## U[448,2]   -0.6312  0.5142   -1.6130   -0.9838   -0.6408   -0.2859    0.4001
## U[449,1]   -1.2852  1.2842   -3.8080   -2.1410   -1.2850   -0.4237    1.2501
## U[449,2]   -0.0628  0.3120   -0.6681   -0.2733   -0.0646    0.1441    0.5540
## U[450,1]    6.0834  1.1378    3.8680    5.3170    6.0740    6.8430    8.3300
## U[450,2]    0.2206  0.1216   -0.0185    0.1386    0.2210    0.3024    0.4570
## U[451,1]    6.4207  1.3013    3.8760    5.5400    6.4130    7.3030    8.9830
## U[451,2]   -0.1723  0.3276   -0.8149   -0.3941   -0.1724    0.0502    0.4632
## U[452,1]    0.8189  1.2653   -1.6760   -0.0288    0.8184    1.6760    3.3140
## U[452,2]   -0.0081  0.1815   -0.3669   -0.1300   -0.0083    0.1132    0.3505
## U[453,1]    0.1771  1.6576   -3.0840   -0.9415    0.1758    1.3000    3.4160
## U[453,2]   -0.5025  0.5812   -1.6060   -0.9050   -0.5161   -0.1144    0.6594
## U[454,1]   -5.6636  1.1460   -7.9190   -6.4330   -5.6580   -4.8920   -3.4210
## U[454,2]    0.0461  0.1216   -0.1940   -0.0355    0.0469    0.1278    0.2838
## U[455,1]   -6.2925  1.2279   -8.7070   -7.1280   -6.2915   -5.4670   -3.8840
## U[455,2]    0.6272  0.1823    0.2701    0.5040    0.6280    0.7488    0.9850
## U[456,1]   -6.1811  1.2921   -8.7110   -7.0500   -6.1870   -5.3080   -3.6400
## U[456,2]    0.3811  0.5145   -0.6084    0.0343    0.3710    0.7216    1.4090
## U[457,1]   -1.2541  1.2093   -3.6180   -2.0720   -1.2550   -0.4332    1.1160
## U[457,2]    0.0773  0.1801   -0.2737   -0.0446    0.0770    0.1975    0.4313
## U[458,1]    6.6901  1.3104    4.1259    5.8080    6.6890    7.5750    9.2460
## U[458,2]   -0.0074  0.5231   -1.0150   -0.3649   -0.0157    0.3453    1.0250
## U[459,1]    6.1669  1.3038    3.6110    5.2830    6.1700    7.0530    8.7250
## U[459,2]    0.1084  0.3303   -0.5364   -0.1145    0.1083    0.3291    0.7590
## U[460,1]    9.9004  1.2186    7.4950    9.0920    9.9030   10.7100   12.2900
## U[460,2]    0.2417  0.1822   -0.1171    0.1184    0.2420    0.3638    0.5979
## U[461,1]   -1.1353  1.2913   -3.6540   -2.0120   -1.1410   -0.2558    1.4000
## U[461,2]    0.0619  0.3200   -0.5660   -0.1553    0.0619    0.2785    0.6903
## U[462,1]   -2.1101  1.3014   -4.6531   -2.9930   -2.1100   -1.2430    0.4769
## U[462,2]    0.0264  0.5142   -0.9416   -0.3304    0.0168    0.3721    1.0650
## U[463,1]   -6.8261  1.2286   -9.2480   -7.6520   -6.8310   -5.9990   -4.4160
## U[463,2]    0.1458  0.1823   -0.2127    0.0233    0.1458    0.2710    0.4992
## U[464,1]   -0.9953  1.5841   -4.0890   -2.0700   -0.9833    0.0770    2.0960
## U[464,2]   -0.4593  0.5683   -1.5350   -0.8506   -0.4737   -0.0794    0.6843
## U[465,1]   -2.1551  1.2806   -4.6690   -3.0110   -2.1590   -1.2980    0.3432
## U[465,2]    0.1629  0.3114   -0.4382   -0.0471    0.1604    0.3706    0.7839
## U[466,1]   -2.4811  1.3950   -5.2030   -3.4350   -2.4790   -1.5440    0.2643
## U[466,2]    0.3391  0.4757   -0.5595    0.0111    0.3286    0.6567    1.3020
## U[467,1]   -0.8846  1.2905   -3.4190   -1.7630   -0.8808   -0.0099    1.6270
## U[467,2]   -0.5176  0.4934   -1.4530   -0.8562   -0.5289   -0.1865    0.4645
## tauz        0.3479  0.0195    0.3107    0.3346    0.3474    0.3608    0.3870
## sigma1     15.4830  1.1241   13.4200   14.7100   15.4300   16.2000   17.8300
## sigma2      0.3920  0.0304    0.3363    0.3711    0.3905    0.4114    0.4561
## sigma12    -0.1509  0.1350   -0.4210   -0.2405   -0.1494   -0.0597    0.1092
## cor        -0.0609  0.0540   -0.1665   -0.0977   -0.0609   -0.0244    0.0452
## deviance 6969.9321 59.7376 6856.0000 6929.0000 6969.0000 7010.0000 7089.0000
##            Rhat n.eff
## beta1[1] 1.0068   350
## beta1[2] 1.0039  1200
## beta1[3] 1.0084   350
## beta1[4] 1.0034   800
## beta1[5] 1.0035   770
## beta1[6] 1.0031   930
## beta2[1] 1.0042   830
## beta2[2] 1.0027  1100
## beta2[3] 1.0029  1000
## beta2[4] 1.0019  2200
## beta2[5] 1.0035   790
## r1       1.0013  6500
## r2       1.0018  2400
## U[1,1]   1.0013  6100
## U[1,2]   1.0010 30000
## U[2,1]   1.0013  5300
## U[2,2]   1.0035   790
## U[3,1]   1.0013  5200
## U[3,2]   1.0010 30000
## U[4,1]   1.0010 30000
## U[4,2]   1.0013  6200
## U[5,1]   1.0010 30000
## U[5,2]   1.0014  4400
## U[6,1]   1.0013  6000
## U[6,2]   1.0011 10000
## U[7,1]   1.0012  9100
## U[7,2]   1.0011 19000
## U[8,1]   1.0019  2000
## U[8,2]   1.0012  9300
## U[9,1]   1.0010 26000
## U[9,2]   1.0011 18000
## U[10,1]  1.0009 30000
## U[10,2]  1.0010 26000
## U[11,1]  1.0010 30000
## U[11,2]  1.0010 30000
## U[12,1]  1.0015  3900
## U[12,2]  1.0034   830
## U[13,1]  1.0014  4500
## U[13,2]  1.0011 11000
## U[14,1]  1.0011 19000
## U[14,2]  1.0010 30000
## U[15,1]  1.0016  3100
## U[15,2]  1.0012  6700
## U[16,1]  1.0014  4400
## U[16,2]  1.0010 30000
## U[17,1]  1.0010 30000
## U[17,2]  1.0011 13000
## U[18,1]  1.0015  3500
## U[18,2]  1.0012  9300
## U[19,1]  1.0015  3400
## U[19,2]  1.0010 22000
## U[20,1]  1.0010 24000
## U[20,2]  1.0013  5400
## U[21,1]  1.0012  8900
## U[21,2]  1.0011 14000
## U[22,1]  1.0012  9200
## U[22,2]  1.0015  3600
## U[23,1]  1.0016  3200
## U[23,2]  1.0011 17000
## U[24,1]  1.0015  3800
## U[24,2]  1.0011 12000
## U[25,1]  1.0013  5100
## U[25,2]  1.0010 30000
## U[26,1]  1.0013  5100
## U[26,2]  1.0014  4900
## U[27,1]  1.0010 30000
## U[27,2]  1.0012  9800
## U[28,1]  1.0010 30000
## U[28,2]  1.0015  3800
## U[29,1]  1.0010 20000
## U[29,2]  1.0010 28000
## U[30,1]  1.0014  4000
## U[30,2]  1.0012  7500
## U[31,1]  1.0023  1500
## U[31,2]  1.0012  9300
## U[32,1]  1.0013  5500
## U[32,2]  1.0013  6100
## U[33,1]  1.0010 30000
## U[33,2]  1.0020  2000
## U[34,1]  1.0013  5800
## U[34,2]  1.0015  3500
## U[35,1]  1.0010 20000
## U[35,2]  1.0018  2400
## U[36,1]  1.0012  9600
## U[36,2]  1.0010 30000
## U[37,1]  1.0010 30000
## U[37,2]  1.0011 12000
## U[38,1]  1.0023  1500
## U[38,2]  1.0010 30000
## U[39,1]  1.0012  8600
## U[39,2]  1.0013  5400
## U[40,1]  1.0011 19000
## U[40,2]  1.0012  8600
## U[41,1]  1.0011 10000
## U[41,2]  1.0012  8900
## U[42,1]  1.0018  2400
## U[42,2]  1.0010 30000
## U[43,1]  1.0010 30000
## U[43,2]  1.0009 30000
## U[44,1]  1.0011 12000
## U[44,2]  1.0010 30000
## U[45,1]  1.0010 30000
## U[45,2]  1.0010 30000
## U[46,1]  1.0020  2000
## U[46,2]  1.0013  5000
## U[47,1]  1.0015  3600
## U[47,2]  1.0010 30000
## U[48,1]  1.0011 10000
## U[48,2]  1.0010 26000
## U[49,1]  1.0010 21000
## U[49,2]  1.0012  8300
## U[50,1]  1.0017  2600
## U[50,2]  1.0014  4200
## U[51,1]  1.0010 30000
## U[51,2]  1.0010 24000
## U[52,1]  1.0010 30000
## U[52,2]  1.0013  6000
## U[53,1]  1.0010 30000
## U[53,2]  1.0010 29000
## U[54,1]  1.0010 30000
## U[54,2]  1.0011 20000
## U[55,1]  1.0010 30000
## U[55,2]  1.0011 10000
## U[56,1]  1.0010 29000
## U[56,2]  1.0012  6900
## U[57,1]  1.0012  8800
## U[57,2]  1.0012  9400
## U[58,1]  1.0013  5000
## U[58,2]  1.0011 20000
## U[59,1]  1.0010 30000
## U[59,2]  1.0012  9500
## U[60,1]  1.0011 14000
## U[60,2]  1.0012  7400
## U[61,1]  1.0011 12000
## U[61,2]  1.0011 14000
## U[62,1]  1.0017  2800
## U[62,2]  1.0012  9000
## U[63,1]  1.0015  3700
## U[63,2]  1.0014  4700
## U[64,1]  1.0011 15000
## U[64,2]  1.0012  9600
## U[65,1]  1.0011 14000
## U[65,2]  1.0011 18000
## U[66,1]  1.0011 14000
## U[66,2]  1.0011 10000
## U[67,1]  1.0010 30000
## U[67,2]  1.0014  4200
## U[68,1]  1.0013  5900
## U[68,2]  1.0010 30000
## U[69,1]  1.0013  6300
## U[69,2]  1.0011 14000
## U[70,1]  1.0010 27000
## U[70,2]  1.0010 30000
## U[71,1]  1.0012  7500
## U[71,2]  1.0010 30000
## U[72,1]  1.0010 30000
## U[72,2]  1.0012  7900
## U[73,1]  1.0015  3900
## U[73,2]  1.0011 12000
## U[74,1]  1.0010 21000
## U[74,2]  1.0012  8000
## U[75,1]  1.0016  3200
## U[75,2]  1.0010 21000
## U[76,1]  1.0011 15000
## U[76,2]  1.0010 30000
## U[77,1]  1.0010 30000
## U[77,2]  1.0011 17000
## U[78,1]  1.0010 30000
## U[78,2]  1.0012  7700
## U[79,1]  1.0017  2500
## U[79,2]  1.0014  4700
## U[80,1]  1.0010 30000
## U[80,2]  1.0014  4500
## U[81,1]  1.0010 25000
## U[81,2]  1.0010 30000
## U[82,1]  1.0010 30000
## U[82,2]  1.0019  2200
## U[83,1]  1.0010 30000
## U[83,2]  1.0010 30000
## U[84,1]  1.0010 30000
## U[84,2]  1.0011 16000
## U[85,1]  1.0014  4000
## U[85,2]  1.0012  6700
## U[86,1]  1.0013  5800
## U[86,2]  1.0017  2600
## U[87,1]  1.0013  6000
## U[87,2]  1.0010 30000
## U[88,1]  1.0012  8800
## U[88,2]  1.0010 20000
## U[89,1]  1.0013  6600
## U[89,2]  1.0016  3200
## U[90,1]  1.0010 30000
## U[90,2]  1.0012  7800
## U[91,1]  1.0013  6100
## U[91,2]  1.0010 30000
## U[92,1]  1.0017  2500
## U[92,2]  1.0029  1000
## U[93,1]  1.0012  7900
## U[93,2]  1.0015  3700
## U[94,1]  1.0013  5300
## U[94,2]  1.0017  2600
## U[95,1]  1.0015  3900
## U[95,2]  1.0011 19000
## U[96,1]  1.0011 15000
## U[96,2]  1.0010 23000
## U[97,1]  1.0010 29000
## U[97,2]  1.0010 30000
## U[98,1]  1.0013  5200
## U[98,2]  1.0011 15000
## U[99,1]  1.0021  1800
## U[99,2]  1.0022  1700
## U[100,1] 1.0010 23000
## U[100,2] 1.0011 16000
## U[101,1] 1.0012  8400
## U[101,2] 1.0012  7300
## U[102,1] 1.0011 13000
## U[102,2] 1.0010 22000
## U[103,1] 1.0011 12000
## U[103,2] 1.0010 30000
## U[104,1] 1.0010 22000
## U[104,2] 1.0010 30000
## U[105,1] 1.0010 22000
## U[105,2] 1.0013  6200
## U[106,1] 1.0013  5600
## U[106,2] 1.0010 29000
## U[107,1] 1.0010 30000
## U[107,2] 1.0011 12000
## U[108,1] 1.0011 15000
## U[108,2] 1.0010 30000
## U[109,1] 1.0013  5800
## U[109,2] 1.0010 30000
## U[110,1] 1.0013  5400
## U[110,2] 1.0012  8900
## U[111,1] 1.0013  5900
## U[111,2] 1.0014  4000
## U[112,1] 1.0012  7400
## U[112,2] 1.0010 23000
## U[113,1] 1.0010 21000
## U[113,2] 1.0010 30000
## U[114,1] 1.0011 14000
## U[114,2] 1.0013  5300
## U[115,1] 1.0011 11000
## U[115,2] 1.0010 30000
## U[116,1] 1.0010 30000
## U[116,2] 1.0012  8000
## U[117,1] 1.0014  4400
## U[117,2] 1.0018  2200
## U[118,1] 1.0010 30000
## U[118,2] 1.0010 30000
## U[119,1] 1.0013  5800
## U[119,2] 1.0012  7500
## U[120,1] 1.0015  3300
## U[120,2] 1.0010 30000
## U[121,1] 1.0012  8900
## U[121,2] 1.0020  1800
## U[122,1] 1.0010 23000
## U[122,2] 1.0010 30000
## U[123,1] 1.0011 12000
## U[123,2] 1.0014  4400
## U[124,1] 1.0013  6000
## U[124,2] 1.0014  4400
## U[125,1] 1.0016  3300
## U[125,2] 1.0013  5000
## U[126,1] 1.0011 17000
## U[126,2] 1.0014  4900
## U[127,1] 1.0010 30000
## U[127,2] 1.0010 30000
## U[128,1] 1.0014  4800
## U[128,2] 1.0010 30000
## U[129,1] 1.0010 24000
## U[129,2] 1.0011 11000
## U[130,1] 1.0010 25000
## U[130,2] 1.0011 13000
## U[131,1] 1.0016  3200
## U[131,2] 1.0012  7000
## U[132,1] 1.0016  3300
## U[132,2] 1.0012  8600
## U[133,1] 1.0012  8000
## U[133,2] 1.0013  6300
## U[134,1] 1.0011 13000
## U[134,2] 1.0013  6200
## U[135,1] 1.0015  3700
## U[135,2] 1.0012  8700
## U[136,1] 1.0011 12000
## U[136,2] 1.0010 30000
## U[137,1] 1.0012  9400
## U[137,2] 1.0029  1000
## U[138,1] 1.0010 30000
## U[138,2] 1.0011 14000
## U[139,1] 1.0009 30000
## U[139,2] 1.0013  5000
## U[140,1] 1.0011 19000
## U[140,2] 1.0010 30000
## U[141,1] 1.0012  8500
## U[141,2] 1.0011 10000
## U[142,1] 1.0010 30000
## U[142,2] 1.0013  5600
## U[143,1] 1.0011 12000
## U[143,2] 1.0012  9100
## U[144,1] 1.0010 30000
## U[144,2] 1.0014  4500
## U[145,1] 1.0013  6400
## U[145,2] 1.0015  3800
## U[146,1] 1.0015  3900
## U[146,2] 1.0011 18000
## U[147,1] 1.0009 30000
## U[147,2] 1.0011 19000
## U[148,1] 1.0010 28000
## U[148,2] 1.0010 20000
## U[149,1] 1.0013  6100
## U[149,2] 1.0013  6300
## U[150,1] 1.0017  2700
## U[150,2] 1.0017  2600
## U[151,1] 1.0012  9700
## U[151,2] 1.0010 26000
## U[152,1] 1.0011 16000
## U[152,2] 1.0009 30000
## U[153,1] 1.0013  5100
## U[153,2] 1.0018  2400
## U[154,1] 1.0011 13000
## U[154,2] 1.0013  6300
## U[155,1] 1.0011 12000
## U[155,2] 1.0011 15000
## U[156,1] 1.0010 22000
## U[156,2] 1.0011 19000
## U[157,1] 1.0015  3500
## U[157,2] 1.0014  4500
## U[158,1] 1.0010 30000
## U[158,2] 1.0014  4500
## U[159,1] 1.0010 26000
## U[159,2] 1.0015  3900
## U[160,1] 1.0017  2800
## U[160,2] 1.0013  5800
## U[161,1] 1.0013  6200
## U[161,2] 1.0010 26000
## U[162,1] 1.0015  3500
## U[162,2] 1.0010 30000
## U[163,1] 1.0010 30000
## U[163,2] 1.0010 30000
## U[164,1] 1.0011 19000
## U[164,2] 1.0010 30000
## U[165,1] 1.0010 24000
## U[165,2] 1.0012  9200
## U[166,1] 1.0011 11000
## U[166,2] 1.0010 30000
## U[167,1] 1.0010 23000
## U[167,2] 1.0012  9600
## U[168,1] 1.0012  6700
## U[168,2] 1.0011 13000
## U[169,1] 1.0014  4700
## U[169,2] 1.0010 30000
## U[170,1] 1.0011 16000
## U[170,2] 1.0010 26000
## U[171,1] 1.0012  8300
## U[171,2] 1.0011 11000
## U[172,1] 1.0011 13000
## U[172,2] 1.0010 20000
## U[173,1] 1.0011 19000
## U[173,2] 1.0011 13000
## U[174,1] 1.0016  3300
## U[174,2] 1.0010 29000
## U[175,1] 1.0010 27000
## U[175,2] 1.0010 30000
## U[176,1] 1.0010 29000
## U[176,2] 1.0014  4200
## U[177,1] 1.0012  9700
## U[177,2] 1.0013  5300
## U[178,1] 1.0012  6900
## U[178,2] 1.0011 13000
## U[179,1] 1.0011 14000
## U[179,2] 1.0016  3300
## U[180,1] 1.0011 18000
## U[180,2] 1.0014  4100
## U[181,1] 1.0012  9600
## U[181,2] 1.0010 30000
## U[182,1] 1.0011 10000
## U[182,2] 1.0014  4700
## U[183,1] 1.0011 11000
## U[183,2] 1.0011 14000
## U[184,1] 1.0012  8200
## U[184,2] 1.0022  1600
## U[185,1] 1.0010 30000
## U[185,2] 1.0013  5700
## U[186,1] 1.0010 30000
## U[186,2] 1.0014  4600
## U[187,1] 1.0010 30000
## U[187,2] 1.0014  4700
## U[188,1] 1.0014  4300
## U[188,2] 1.0015  3900
## U[189,1] 1.0017  2600
## U[189,2] 1.0012  6900
## U[190,1] 1.0011 12000
## U[190,2] 1.0011 15000
## U[191,1] 1.0028  1100
## U[191,2] 1.0016  3100
## U[192,1] 1.0010 23000
## U[192,2] 1.0016  3300
## U[193,1] 1.0012  6700
## U[193,2] 1.0011 20000
## U[194,1] 1.0015  3700
## U[194,2] 1.0014  4100
## U[195,1] 1.0013  5600
## U[195,2] 1.0017  2700
## U[196,1] 1.0011 10000
## U[196,2] 1.0010 30000
## U[197,1] 1.0010 22000
## U[197,2] 1.0010 30000
## U[198,1] 1.0023  1400
## U[198,2] 1.0012  7300
## U[199,1] 1.0010 30000
## U[199,2] 1.0015  3600
## U[200,1] 1.0011 13000
## U[200,2] 1.0013  6200
## U[201,1] 1.0010 21000
## U[201,2] 1.0010 30000
## U[202,1] 1.0013  5900
## U[202,2] 1.0010 30000
## U[203,1] 1.0014  4100
## U[203,2] 1.0010 30000
## U[204,1] 1.0015  3400
## U[204,2] 1.0016  3000
## U[205,1] 1.0013  5300
## U[205,2] 1.0010 29000
## U[206,1] 1.0017  2600
## U[206,2] 1.0015  3800
## U[207,1] 1.0010 30000
## U[207,2] 1.0011 14000
## U[208,1] 1.0010 30000
## U[208,2] 1.0012  8800
## U[209,1] 1.0015  3500
## U[209,2] 1.0025  1300
## U[210,1] 1.0022  1600
## U[210,2] 1.0016  3200
## U[211,1] 1.0012  9400
## U[211,2] 1.0010 20000
## U[212,1] 1.0011 16000
## U[212,2] 1.0013  6200
## U[213,1] 1.0012  9600
## U[213,2] 1.0010 30000
## U[214,1] 1.0010 29000
## U[214,2] 1.0011 17000
## U[215,1] 1.0010 30000
## U[215,2] 1.0015  3900
## U[216,1] 1.0013  6400
## U[216,2] 1.0015  3700
## U[217,1] 1.0014  4900
## U[217,2] 1.0013  5500
## U[218,1] 1.0015  3700
## U[218,2] 1.0010 27000
## U[219,1] 1.0012  7100
## U[219,2] 1.0015  3400
## U[220,1] 1.0011 14000
## U[220,2] 1.0010 30000
## U[221,1] 1.0010 20000
## U[221,2] 1.0012  7900
## U[222,1] 1.0011 14000
## U[222,2] 1.0022  1600
## U[223,1] 1.0012  7000
## U[223,2] 1.0010 30000
## U[224,1] 1.0014  4400
## U[224,2] 1.0011 19000
## U[225,1] 1.0015  3600
## U[225,2] 1.0011 16000
## U[226,1] 1.0012  7000
## U[226,2] 1.0010 23000
## U[227,1] 1.0010 30000
## U[227,2] 1.0010 30000
## U[228,1] 1.0012  7300
## U[228,2] 1.0010 30000
## U[229,1] 1.0010 30000
## U[229,2] 1.0010 30000
## U[230,1] 1.0011 20000
## U[230,2] 1.0010 30000
## U[231,1] 1.0014  4400
## U[231,2] 1.0018  2500
## U[232,1] 1.0019  2100
## U[232,2] 1.0018  2300
## U[233,1] 1.0012  9400
## U[233,2] 1.0011 20000
## U[234,1] 1.0017  2600
## U[234,2] 1.0016  3000
## U[235,1] 1.0011 10000
## U[235,2] 1.0011 13000
## U[236,1] 1.0012  7300
## U[236,2] 1.0015  3400
## U[237,1] 1.0013  6500
## U[237,2] 1.0010 30000
## U[238,1] 1.0010 22000
## U[238,2] 1.0012  8800
## U[239,1] 1.0011 12000
## U[239,2] 1.0010 30000
## U[240,1] 1.0014  4800
## U[240,2] 1.0011 12000
## U[241,1] 1.0019  2200
## U[241,2] 1.0019  2100
## U[242,1] 1.0011 10000
## U[242,2] 1.0016  3000
## U[243,1] 1.0012  7300
## U[243,2] 1.0010 30000
## U[244,1] 1.0013  5200
## U[244,2] 1.0018  2400
## U[245,1] 1.0018  2400
## U[245,2] 1.0019  2200
## U[246,1] 1.0015  3500
## U[246,2] 1.0012  7600
## U[247,1] 1.0010 30000
## U[247,2] 1.0011 17000
## U[248,1] 1.0014  4800
## U[248,2] 1.0011 16000
## U[249,1] 1.0014  4900
## U[249,2] 1.0013  6400
## U[250,1] 1.0023  1500
## U[250,2] 1.0010 25000
## U[251,1] 1.0010 30000
## U[251,2] 1.0010 30000
## U[252,1] 1.0014  4500
## U[252,2] 1.0015  3900
## U[253,1] 1.0014  4600
## U[253,2] 1.0012  7000
## U[254,1] 1.0015  3500
## U[254,2] 1.0011 10000
## U[255,1] 1.0016  2900
## U[255,2] 1.0013  6300
## U[256,1] 1.0014  4400
## U[256,2] 1.0011 15000
## U[257,1] 1.0012  9200
## U[257,2] 1.0011 10000
## U[258,1] 1.0023  1500
## U[258,2] 1.0013  5500
## U[259,1] 1.0012  7100
## U[259,2] 1.0010 30000
## U[260,1] 1.0015  3700
## U[260,2] 1.0012  7500
## U[261,1] 1.0013  6200
## U[261,2] 1.0010 30000
## U[262,1] 1.0010 30000
## U[262,2] 1.0016  2900
## U[263,1] 1.0030   990
## U[263,2] 1.0014  4200
## U[264,1] 1.0011 16000
## U[264,2] 1.0016  3200
## U[265,1] 1.0012  7700
## U[265,2] 1.0010 30000
## U[266,1] 1.0010 22000
## U[266,2] 1.0012  8300
## U[267,1] 1.0015  3600
## U[267,2] 1.0022  1600
## U[268,1] 1.0021  1700
## U[268,2] 1.0010 30000
## U[269,1] 1.0016  3200
## U[269,2] 1.0011 17000
## U[270,1] 1.0011 12000
## U[270,2] 1.0010 26000
## U[271,1] 1.0012  7100
## U[271,2] 1.0013  6400
## U[272,1] 1.0016  3100
## U[272,2] 1.0017  2800
## U[273,1] 1.0010 30000
## U[273,2] 1.0013  5300
## U[274,1] 1.0014  4800
## U[274,2] 1.0017  2600
## U[275,1] 1.0011 18000
## U[275,2] 1.0029  1000
## U[276,1] 1.0011 13000
## U[276,2] 1.0016  2900
## U[277,1] 1.0010 30000
## U[277,2] 1.0010 22000
## U[278,1] 1.0015  3400
## U[278,2] 1.0012  7400
## U[279,1] 1.0011 13000
## U[279,2] 1.0012  7400
## U[280,1] 1.0012  8600
## U[280,2] 1.0012  7200
## U[281,1] 1.0015  3500
## U[281,2] 1.0013  5900
## U[282,1] 1.0012  7700
## U[282,2] 1.0012  8700
## U[283,1] 1.0012  9500
## U[283,2] 1.0017  2600
## U[284,1] 1.0011 11000
## U[284,2] 1.0013  6400
## U[285,1] 1.0012  9300
## U[285,2] 1.0011 11000
## U[286,1] 1.0010 30000
## U[286,2] 1.0011 19000
## U[287,1] 1.0010 30000
## U[287,2] 1.0010 29000
## U[288,1] 1.0010 22000
## U[288,2] 1.0010 22000
## U[289,1] 1.0012  6800
## U[289,2] 1.0012  7300
## U[290,1] 1.0012  7800
## U[290,2] 1.0015  3700
## U[291,1] 1.0011 15000
## U[291,2] 1.0010 29000
## U[292,1] 1.0014  4400
## U[292,2] 1.0012  9700
## U[293,1] 1.0013  5900
## U[293,2] 1.0014  4500
## U[294,1] 1.0011 15000
## U[294,2] 1.0012  8300
## U[295,1] 1.0018  2500
## U[295,2] 1.0011 12000
## U[296,1] 1.0010 20000
## U[296,2] 1.0013  6000
## U[297,1] 1.0010 21000
## U[297,2] 1.0013  6200
## U[298,1] 1.0010 25000
## U[298,2] 1.0013  5800
## U[299,1] 1.0010 30000
## U[299,2] 1.0010 30000
## U[300,1] 1.0012  9200
## U[300,2] 1.0010 30000
## U[301,1] 1.0010 30000
## U[301,2] 1.0018  2300
## U[302,1] 1.0011 11000
## U[302,2] 1.0012  8800
## U[303,1] 1.0014  4100
## U[303,2] 1.0012  8500
## U[304,1] 1.0010 30000
## U[304,2] 1.0016  3200
## U[305,1] 1.0012  7100
## U[305,2] 1.0011 12000
## U[306,1] 1.0014  4600
## U[306,2] 1.0017  2600
## U[307,1] 1.0012  9400
## U[307,2] 1.0011 15000
## U[308,1] 1.0011 16000
## U[308,2] 1.0011 17000
## U[309,1] 1.0014  4300
## U[309,2] 1.0014  4700
## U[310,1] 1.0011 11000
## U[310,2] 1.0012  9100
## U[311,1] 1.0013  6000
## U[311,2] 1.0012  6900
## U[312,1] 1.0022  1600
## U[312,2] 1.0010 30000
## U[313,1] 1.0012  6800
## U[313,2] 1.0017  2800
## U[314,1] 1.0012  9700
## U[314,2] 1.0010 30000
## U[315,1] 1.0012  9700
## U[315,2] 1.0017  2800
## U[316,1] 1.0010 30000
## U[316,2] 1.0012  7300
## U[317,1] 1.0016  2900
## U[317,2] 1.0013  6400
## U[318,1] 1.0013  6200
## U[318,2] 1.0026  1200
## U[319,1] 1.0010 30000
## U[319,2] 1.0011 16000
## U[320,1] 1.0013  5800
## U[320,2] 1.0011 11000
## U[321,1] 1.0010 30000
## U[321,2] 1.0010 30000
## U[322,1] 1.0012  8300
## U[322,2] 1.0010 30000
## U[323,1] 1.0018  2300
## U[323,2] 1.0018  2400
## U[324,1] 1.0016  2900
## U[324,2] 1.0020  1800
## U[325,1] 1.0012  8500
## U[325,2] 1.0010 21000
## U[326,1] 1.0011 13000
## U[326,2] 1.0010 22000
## U[327,1] 1.0012  8100
## U[327,2] 1.0016  2900
## U[328,1] 1.0010 30000
## U[328,2] 1.0010 30000
## U[329,1] 1.0010 30000
## U[329,2] 1.0010 30000
## U[330,1] 1.0010 30000
## U[330,2] 1.0016  2900
## U[331,1] 1.0017  2700
## U[331,2] 1.0016  3200
## U[332,1] 1.0013  5800
## U[332,2] 1.0016  2900
## U[333,1] 1.0010 30000
## U[333,2] 1.0013  6500
## U[334,1] 1.0011 15000
## U[334,2] 1.0011 15000
## U[335,1] 1.0011 14000
## U[335,2] 1.0011 11000
## U[336,1] 1.0013  5400
## U[336,2] 1.0013  5100
## U[337,1] 1.0015  3400
## U[337,2] 1.0010 30000
## U[338,1] 1.0012  8300
## U[338,2] 1.0013  6400
## U[339,1] 1.0021  1700
## U[339,2] 1.0015  3900
## U[340,1] 1.0021  1700
## U[340,2] 1.0017  2500
## U[341,1] 1.0026  1200
## U[341,2] 1.0010 27000
## U[342,1] 1.0014  4400
## U[342,2] 1.0013  5700
## U[343,1] 1.0023  1500
## U[343,2] 1.0015  4000
## U[344,1] 1.0010 30000
## U[344,2] 1.0010 30000
## U[345,1] 1.0015  3400
## U[345,2] 1.0013  6400
## U[346,1] 1.0012  9000
## U[346,2] 1.0017  2800
## U[347,1] 1.0011 15000
## U[347,2] 1.0011 15000
## U[348,1] 1.0011 11000
## U[348,2] 1.0013  5600
## U[349,1] 1.0010 30000
## U[349,2] 1.0012  7700
## U[350,1] 1.0011 14000
## U[350,2] 1.0014  4500
## U[351,1] 1.0026  1200
## U[351,2] 1.0014  4800
## U[352,1] 1.0010 30000
## U[352,2] 1.0011 20000
## U[353,1] 1.0012  8300
## U[353,2] 1.0016  2900
## U[354,1] 1.0011 12000
## U[354,2] 1.0010 30000
## U[355,1] 1.0016  3000
## U[355,2] 1.0010 30000
## U[356,1] 1.0012  9300
## U[356,2] 1.0010 30000
## U[357,1] 1.0010 24000
## U[357,2] 1.0012  7100
## U[358,1] 1.0013  5900
## U[358,2] 1.0014  4200
## U[359,1] 1.0010 30000
## U[359,2] 1.0021  1700
## U[360,1] 1.0011 16000
## U[360,2] 1.0014  4500
## U[361,1] 1.0010 30000
## U[361,2] 1.0010 30000
## U[362,1] 1.0010 27000
## U[362,2] 1.0009 30000
## U[363,1] 1.0014  4300
## U[363,2] 1.0010 30000
## U[364,1] 1.0012  9500
## U[364,2] 1.0011 15000
## U[365,1] 1.0011 10000
## U[365,2] 1.0010 28000
## U[366,1] 1.0011 15000
## U[366,2] 1.0011 15000
## U[367,1] 1.0011 12000
## U[367,2] 1.0010 30000
## U[368,1] 1.0015  3800
## U[368,2] 1.0014  4400
## U[369,1] 1.0010 30000
## U[369,2] 1.0013  6400
## U[370,1] 1.0010 30000
## U[370,2] 1.0012  9000
## U[371,1] 1.0010 30000
## U[371,2] 1.0011 17000
## U[372,1] 1.0010 27000
## U[372,2] 1.0014  4100
## U[373,1] 1.0012  7800
## U[373,2] 1.0012  8700
## U[374,1] 1.0012  9100
## U[374,2] 1.0011 18000
## U[375,1] 1.0014  4700
## U[375,2] 1.0010 30000
## U[376,1] 1.0010 30000
## U[376,2] 1.0010 30000
## U[377,1] 1.0018  2200
## U[377,2] 1.0010 30000
## U[378,1] 1.0013  5100
## U[378,2] 1.0013  6600
## U[379,1] 1.0010 30000
## U[379,2] 1.0010 30000
## U[380,1] 1.0011 14000
## U[380,2] 1.0011 16000
## U[381,1] 1.0012  7500
## U[381,2] 1.0010 30000
## U[382,1] 1.0014  4600
## U[382,2] 1.0013  5700
## U[383,1] 1.0010 30000
## U[383,2] 1.0012  6900
## U[384,1] 1.0013  5200
## U[384,2] 1.0012  8600
## U[385,1] 1.0010 21000
## U[385,2] 1.0010 30000
## U[386,1] 1.0011 16000
## U[386,2] 1.0012  7300
## U[387,1] 1.0014  4700
## U[387,2] 1.0017  2600
## U[388,1] 1.0010 30000
## U[388,2] 1.0010 30000
## U[389,1] 1.0019  2000
## U[389,2] 1.0015  3900
## U[390,1] 1.0010 30000
## U[390,2] 1.0011 10000
## U[391,1] 1.0013  5300
## U[391,2] 1.0020  1900
## U[392,1] 1.0011 10000
## U[392,2] 1.0010 30000
## U[393,1] 1.0010 20000
## U[393,2] 1.0010 30000
## U[394,1] 1.0012  9400
## U[394,2] 1.0011 14000
## U[395,1] 1.0013  6200
## U[395,2] 1.0011 18000
## U[396,1] 1.0015  3500
## U[396,2] 1.0010 26000
## U[397,1] 1.0011 11000
## U[397,2] 1.0010 30000
## U[398,1] 1.0012  8700
## U[398,2] 1.0010 30000
## U[399,1] 1.0012  9700
## U[399,2] 1.0012  9000
## U[400,1] 1.0010 21000
## U[400,2] 1.0011 17000
## U[401,1] 1.0010 30000
## U[401,2] 1.0010 30000
## U[402,1] 1.0010 30000
## U[402,2] 1.0011 16000
## U[403,1] 1.0011 13000
## U[403,2] 1.0010 30000
## U[404,1] 1.0010 30000
## U[404,2] 1.0014  4200
## U[405,1] 1.0013  6500
## U[405,2] 1.0013  5100
## U[406,1] 1.0010 30000
## U[406,2] 1.0011 15000
## U[407,1] 1.0017  2800
## U[407,2] 1.0011 19000
## U[408,1] 1.0011 10000
## U[408,2] 1.0011 14000
## U[409,1] 1.0011 14000
## U[409,2] 1.0015  3800
## U[410,1] 1.0016  2900
## U[410,2] 1.0010 30000
## U[411,1] 1.0018  2400
## U[411,2] 1.0020  2000
## U[412,1] 1.0010 30000
## U[412,2] 1.0010 29000
## U[413,1] 1.0010 30000
## U[413,2] 1.0010 30000
## U[414,1] 1.0011 16000
## U[414,2] 1.0011 11000
## U[415,1] 1.0010 30000
## U[415,2] 1.0011 15000
## U[416,1] 1.0017  2500
## U[416,2] 1.0010 29000
## U[417,1] 1.0010 20000
## U[417,2] 1.0014  4500
## U[418,1] 1.0010 30000
## U[418,2] 1.0010 30000
## U[419,1] 1.0015  3800
## U[419,2] 1.0020  2000
## U[420,1] 1.0011 15000
## U[420,2] 1.0014  4700
## U[421,1] 1.0014  4400
## U[421,2] 1.0018  2500
## U[422,1] 1.0011 10000
## U[422,2] 1.0015  3600
## U[423,1] 1.0011 17000
## U[423,2] 1.0013  6200
## U[424,1] 1.0010 29000
## U[424,2] 1.0012  6800
## U[425,1] 1.0010 30000
## U[425,2] 1.0015  3400
## U[426,1] 1.0010 20000
## U[426,2] 1.0012  9400
## U[427,1] 1.0010 23000
## U[427,2] 1.0011 12000
## U[428,1] 1.0015  3500
## U[428,2] 1.0010 30000
## U[429,1] 1.0022  1600
## U[429,2] 1.0012  9000
## U[430,1] 1.0010 30000
## U[430,2] 1.0013  5300
## U[431,1] 1.0012  8000
## U[431,2] 1.0010 29000
## U[432,1] 1.0011 18000
## U[432,2] 1.0010 24000
## U[433,1] 1.0012  7400
## U[433,2] 1.0010 30000
## U[434,1] 1.0014  4600
## U[434,2] 1.0010 30000
## U[435,1] 1.0010 30000
## U[435,2] 1.0012  9000
## U[436,1] 1.0015  3700
## U[436,2] 1.0010 30000
## U[437,1] 1.0010 30000
## U[437,2] 1.0012  6900
## U[438,1] 1.0033   850
## U[438,2] 1.0017  2600
## U[439,1] 1.0013  5700
## U[439,2] 1.0012  6800
## U[440,1] 1.0010 22000
## U[440,2] 1.0010 20000
## U[441,1] 1.0012  7200
## U[441,2] 1.0010 30000
## U[442,1] 1.0012  7400
## U[442,2] 1.0011 17000
## U[443,1] 1.0017  2600
## U[443,2] 1.0011 13000
## U[444,1] 1.0010 30000
## U[444,2] 1.0011 15000
## U[445,1] 1.0013  5100
## U[445,2] 1.0011 19000
## U[446,1] 1.0014  4200
## U[446,2] 1.0011 14000
## U[447,1] 1.0012  7200
## U[447,2] 1.0010 30000
## U[448,1] 1.0012  9000
## U[448,2] 1.0011 12000
## U[449,1] 1.0014  4900
## U[449,2] 1.0011 15000
## U[450,1] 1.0011 10000
## U[450,2] 1.0019  2200
## U[451,1] 1.0014  4200
## U[451,2] 1.0014  4200
## U[452,1] 1.0012  9100
## U[452,2] 1.0018  2300
## U[453,1] 1.0017  2800
## U[453,2] 1.0010 23000
## U[454,1] 1.0021  1800
## U[454,2] 1.0020  2000
## U[455,1] 1.0012  9500
## U[455,2] 1.0012  7300
## U[456,1] 1.0016  3100
## U[456,2] 1.0016  3100
## U[457,1] 1.0011 10000
## U[457,2] 1.0011 17000
## U[458,1] 1.0011 10000
## U[458,2] 1.0012  9500
## U[459,1] 1.0018  2300
## U[459,2] 1.0011 17000
## U[460,1] 1.0010 30000
## U[460,2] 1.0015  3400
## U[461,1] 1.0011 15000
## U[461,2] 1.0015  3400
## U[462,1] 1.0011 11000
## U[462,2] 1.0011 16000
## U[463,1] 1.0018  2200
## U[463,2] 1.0025  1300
## U[464,1] 1.0009 30000
## U[464,2] 1.0009 30000
## U[465,1] 1.0014  4400
## U[465,2] 1.0010 30000
## U[466,1] 1.0018  2400
## U[466,2] 1.0012  8800
## U[467,1] 1.0012  8800
## U[467,2] 1.0011 14000
## tauz     1.0013  5300
## sigma1   1.0010 30000
## sigma2   1.0017  2600
## sigma12  1.0013  5300
## cor      1.0013  5000
## deviance 1.0014  4500
## 
## For each parameter, n.eff is a crude measure of effective sample size,
## and Rhat is the potential scale reduction factor (at convergence, Rhat=1).
## 
## DIC info (using the rule, pD = Dbar-Dhat)
## pD = 757.2 and DIC = 7727.1
## DIC is an estimate of expected predictive error (lower deviance is better).
cat("\nMODEL XI DIC\n")
## 
## MODEL XI DIC
cat(
  "DIC =",
  fit.model.xi$DIC,
  "\n"
)
## DIC = 7727.13
cat(
  "pD =",
  fit.model.xi$pD,
  "\n"
)
## pD = 757.198
cat(
  "Dbar approximately =",
  fit.model.xi$DIC - fit.model.xi$pD,
  "\n"
)
## Dbar approximately = 6969.932
# =============================================================================
# 16. SAVE MODEL XI
# =============================================================================

saveRDS(
  fit.model.xi,
  file.path(
    working.directory,
    "Guo_Carlin_Model_XI_fit.rds"
  )
)


# =============================================================================
# 17. RUN MODEL XII
# =============================================================================


inits.XII <- lapply(
  seq_len(n.chains),
  create.inits.XII
)


fit.model.xii <- bugs(
  
  data = data.XII,
  
  inits = inits.XII,
  
  parameters.to.save = parameters.XII,
  
  model.file = model.file.XII,
  
  n.chains = n.chains,
  
  n.iter = n.iter,
  
  n.burnin = n.burnin,
  
  n.thin = n.thin,
  
  DIC = TRUE,
  
  bugs.directory = bugs.directory,
  
  working.directory = working.directory,
  
  debug = FALSE,
  
  codaPkg = FALSE,
  
  clearWD = FALSE
)


cat("\nMODEL XII COMPLETE\n")
## 
## MODEL XII COMPLETE
print(
  fit.model.xii,
  digits = 4
)
## Inference for Bugs model at "D:/Joint_model/winBUGS/Guo_Carlin_Model_XII.txt", fit using WinBUGS,
##  3 chains, each with 15000 iterations (first 5000 discarded)
##  n.sims = 30000 iterations saved
##               mean      sd      2.5%       25%       50%       75%     97.5%
## beta1[1]    8.0650  0.3604    7.3610    7.8190    8.0690    8.3090    8.7700
## beta1[2]   -0.2277  0.1010   -0.4232   -0.3138   -0.2044   -0.1495   -0.0693
## beta1[3]    0.0440  0.0731   -0.0970   -0.0051    0.0432    0.0923    0.1933
## beta1[4]   -0.1309  0.3261   -0.7643   -0.3488   -0.1329    0.0898    0.5092
## beta1[5]   -2.3192  0.2323   -2.7840   -2.4740   -2.3160   -2.1620   -1.8750
## beta1[6]   -0.1127  0.2297   -0.5673   -0.2682   -0.1125    0.0421    0.3441
## beta2[1]   -4.0870  0.2298   -4.5340   -4.2420   -4.0880   -3.9310   -3.6400
## beta2[2]    0.2551  0.1716   -0.0754    0.1384    0.2531    0.3695    0.5958
## beta2[3]   -0.0720  0.1526   -0.3625   -0.1767   -0.0746    0.0284    0.2381
## beta2[4]    0.6724  0.1338    0.4148    0.5809    0.6716    0.7619    0.9392
## beta2[5]    0.0905  0.0979   -0.1015    0.0243    0.0901    0.1561    0.2845
## r1         -0.1722  0.2427   -0.4284   -0.3555   -0.3057    0.1280    0.2391
## r2         -1.1437  2.9923   -4.1270   -3.3870   -2.8800    2.7033    3.7180
## r3          0.0058  0.2548   -0.4196   -0.3151    0.1507    0.1980    0.2674
## tauz        0.3470  0.0194    0.3100    0.3338    0.3469    0.3598    0.3861
## sigma1     15.4719  1.1453   13.3600   14.6800   15.4200   16.2100   17.8500
## sigma2      0.3938  0.0316    0.3369    0.3721    0.3920    0.4138    0.4607
## sigma12    -0.1971  0.1574   -0.5208   -0.3011   -0.1908   -0.0885    0.0927
## cor        -0.0790  0.0619   -0.2022   -0.1210   -0.0778   -0.0365    0.0382
## deviance 6943.5125 61.1285 6826.0000 6902.0000 6943.0000 6984.0000 7066.0000
##             Rhat n.eff
## beta1[1]  1.0611    38
## beta1[2]  3.0339     4
## beta1[3]  1.1454    18
## beta1[4]  1.0022  3000
## beta1[5]  1.0053   540
## beta1[6]  1.0015  3900
## beta2[1]  1.3080    11
## beta2[2]  1.0135   170
## beta2[3]  1.0078   300
## beta2[4]  1.0393    56
## beta2[5]  1.0014  4600
## r1        8.4735     3
## r2       10.7974     3
## r3        9.4605     3
## tauz      1.0016  3200
## sigma1    1.0320    68
## sigma2    1.0619    38
## sigma12   1.3696     9
## cor       1.3441    10
## deviance  1.0473    48
## 
## For each parameter, n.eff is a crude measure of effective sample size,
## and Rhat is the potential scale reduction factor (at convergence, Rhat=1).
## 
## DIC info (using the rule, pD = Dbar-Dhat)
## pD = 665.0 and DIC = 7608.5
## DIC is an estimate of expected predictive error (lower deviance is better).
cat("\nMODEL XII DIC\n")
## 
## MODEL XII DIC
cat(
  "DIC =",
  fit.model.xii$DIC,
  "\n"
)
## DIC = 7608.51
cat(
  "pD =",
  fit.model.xii$pD,
  "\n"
)
## pD = 665.001
cat(
  "Dbar approximately =",
  fit.model.xii$DIC - fit.model.xii$pD,
  "\n"
)
## Dbar approximately = 6943.509
# =============================================================================
# 18. SAVE MODEL XII
# =============================================================================

saveRDS(
  fit.model.xii,
  file.path(
    working.directory,
    "Guo_Carlin_Model_XII_fit.rds"
  )
)


# =============================================================================
# 19. DIC COMPARISON
# =============================================================================

DIC.table <- data.frame(
  
  Model = c(
    "XI",
    "XII"
  ),
  
  Dbar = c(
    fit.model.xi$DIC -
      fit.model.xi$pD,
    
    fit.model.xii$DIC -
      fit.model.xii$pD
  ),
  
  pD = c(
    fit.model.xi$pD,
    fit.model.xii$pD
  ),
  
  DIC = c(
    fit.model.xi$DIC,
    fit.model.xii$DIC
  )
)


DIC.table$Delta_DIC <-
  DIC.table$DIC -
  min(DIC.table$DIC)


cat("\n")
cat("============================================================\n")
## ============================================================
cat("DIC COMPARISON\n")
## DIC COMPARISON
cat("============================================================\n")
## ============================================================
print(
  DIC.table,
  digits = 4,
  row.names = FALSE
)
##  Model Dbar    pD  DIC Delta_DIC
##     XI 6970 757.2 7727     118.6
##    XII 6944 665.0 7609       0.0

R code for reproduce figure (a) and (b)

# =============================================================================
# FIGURE 2
# GUO AND CARLIN JOINT LONGITUDINAL-SURVIVAL MODEL
#
# Panel (a): Separate survival analysis
# Panel (b): Joint analysis using fitted Model XI
#
# Hypothetical patient:
#   Male
#   AIDS-negative at study entry
#   Intolerant of AZT
#
# Compare:
#   ddI vs ddC
#
# For exponential survival:
#
#   lambda = exp(eta)
#
#   Median survival = log(2) / lambda
#                   = log(2) / exp(eta)
# =============================================================================


# =============================================================================
# 0. USER SETTINGS
# =============================================================================

working.directory <- "D:/Joint_model/winBUGS"

bugs.directory <- "D:/WinBUGS14/"

setwd(working.directory)


# =============================================================================
# 1. LOAD PACKAGES
# =============================================================================

library(R2WinBUGS)
library(JMbayes2)
library(dplyr)
library(coda)


# =============================================================================
# 2. LOAD DATA
# =============================================================================

data("aids", package = "JMbayes2")
data("aids.id", package = "JMbayes2")


# =============================================================================
# 3. LOAD FITTED JOINT MODEL XI
# =============================================================================

model.xi.file <- file.path(
  working.directory,
  "Guo_Carlin_Model_XI_fit.rds"
)

if (!file.exists(model.xi.file)) {
  
  stop(
    paste0(
      "Cannot find:\n",
      model.xi.file,
      "\n\nRun Model XI first."
    )
  )
}

fit.model.xi <- readRDS(
  model.xi.file
)

cat("\nModel XI successfully loaded.\n")
## 
## Model XI successfully loaded.
# =============================================================================
# 4. CREATE THE SAME COVARIATE CODING USED IN MODEL XI
# =============================================================================

# IMPORTANT:
#
# This must be identical to the coding used when Model XI was fitted.
#
# randgrp1:
#   ddC = 0
#   ddI = 1
#
# gender1:
#   female = -1
#   male   =  1
#
# prevoi1:
#   AIDS-negative = -1
#   AIDS          =  1
#
# stratum1:
#   AZT intolerance = -1
#   AZT failure     =  1


aids.id <- aids.id %>%
  mutate(
    
    randgrp1 = ifelse(
      as.character(drug) == "ddI",
      1,
      0
    ),
    
    gender1 = ifelse(
      as.character(gender) == "male",
      1,
      -1
    ),
    
    prevoi1 = ifelse(
      as.character(prevOI) == "AIDS",
      1,
      -1
    ),
    
    stratum1 = ifelse(
      as.character(AZT) == "failure",
      1,
      -1
    ),
    
    event = as.integer(death)
  )


# =============================================================================
# 5. VERIFY TREATMENT CODING
# =============================================================================

cat("\nTreatment coding:\n")
## 
## Treatment coding:
print(
  table(
    drug = aids.id$drug,
    randgrp1 = aids.id$randgrp1
  )
)
##      randgrp1
## drug    0   1
##   ddC 237   0
##   ddI   0 230
# Automatically determine coding rather than manually assuming it

randgrp.ddI <- unique(
  aids.id$randgrp1[
    as.character(aids.id$drug) == "ddI"
  ]
)

randgrp.ddC <- unique(
  aids.id$randgrp1[
    as.character(aids.id$drug) == "ddC"
  ]
)


if (length(randgrp.ddI) != 1L) {
  stop("Could not uniquely identify ddI treatment coding.")
}

if (length(randgrp.ddC) != 1L) {
  stop("Could not uniquely identify ddC treatment coding.")
}

if (randgrp.ddI == randgrp.ddC) {
  stop("ERROR: ddI and ddC have identical treatment coding.")
}


cat(
  "\nConfirmed treatment coding:\n",
  "ddI =", randgrp.ddI, "\n",
  "ddC =", randgrp.ddC, "\n"
)
## 
## Confirmed treatment coding:
##  ddI = 1 
##  ddC = 0
# Expected for your data:
#
# ddI = 1
# ddC = 0


# =============================================================================
# 6. DEFINE HYPOTHETICAL PATIENT
# =============================================================================

# Male
gender.patient <- 1

# AIDS-negative at study entry
prevoi.patient <- -1

# Intolerant of AZT
stratum.patient <- -1


cat("\nHypothetical patient:\n")
## 
## Hypothetical patient:
cat("Male                : gender1 =", gender.patient, "\n")
## Male                : gender1 = 1
cat("AIDS-negative       : prevoi1 =", prevoi.patient, "\n")
## AIDS-negative       : prevoi1 = -1
cat("AZT intolerant      : stratum1 =", stratum.patient, "\n")
## AZT intolerant      : stratum1 = -1
# =============================================================================
# 7. PREPARE SURVIVAL DATA FOR SEPARATE MODEL
# =============================================================================

N <- nrow(aids.id)

event <- as.integer(
  aids.id$event
)

followup.time <- as.numeric(
  aids.id$Time
)


# Right-censored data for WinBUGS:
#
# Death:
#   surt = death time
#   surt.cen = 0
#
# Censored:
#   surt = NA
#   surt.cen = censoring time


surt <- ifelse(
  event == 1L,
  followup.time,
  NA_real_
)

surt.cen <- ifelse(
  event == 0L,
  followup.time,
  0
)


cat("\nSurvival data:\n")
## 
## Survival data:
cat(
  "Deaths    =",
  sum(event == 1L),
  "\n"
)
## Deaths    = 188
cat(
  "Censored  =",
  sum(event == 0L),
  "\n"
)
## Censored  = 279
# =============================================================================
# 8. SEPARATE SURVIVAL MODEL DATA
# =============================================================================

separate.data <- list(
  
  N = N,
  
  randgrp1 =
    as.numeric(aids.id$randgrp1),
  
  gender1 =
    as.numeric(aids.id$gender1),
  
  prevoi1 =
    as.numeric(aids.id$prevoi1),
  
  stratum1 =
    as.numeric(aids.id$stratum1),
  
  surt = surt,
  
  surt.cen = surt.cen,
  
  betamu2 =
    rep(0, 5),
  
  # WinBUGS dmnorm uses PRECISION.
  #
  # precision = 0.001
  # variance  = 1000
  
  Prec2 =
    diag(0.001, 5)
)


# =============================================================================
# 9. WINBUGS SEPARATE SURVIVAL MODEL
# =============================================================================

separate.model <- "
model {

  for (i in 1:N) {

    surt[i] ~ dweib(1, lambda[i]) I(surt.cen[i], )

    log(lambda[i]) <-
        beta2[1]
      + beta2[2] * randgrp1[i]
      + beta2[3] * gender1[i]
      + beta2[4] * prevoi1[i]
      + beta2[5] * stratum1[i]
  }

  beta2[1:5] ~ dmnorm(
    betamu2[],
    Prec2[,]
  )
}
"


separate.model.file <- file.path(
  working.directory,
  "Figure2_separate_survival_model.txt"
)


writeLines(
  separate.model,
  separate.model.file
)


# =============================================================================
# 10. INITIAL VALUES FOR SEPARATE MODEL
# =============================================================================

create.separate.inits <- function(chain.id) {
  
  set.seed(
    8000 + chain.id
  )
  
  
  # Initial values for latent survival times
  # of censored subjects
  
  surt.initial <- rep(
    NA_real_,
    N
  )
  
  
  censored.index <- which(
    event == 0L
  )
  
  
  surt.initial[censored.index] <-
    followup.time[censored.index] +
    runif(
      length(censored.index),
      min = 0.1,
      max = 5
    )
  
  
  list(
    
    beta2 = c(
      -4,
      0,
      0,
      0,
      0
    ),
    
    surt =
      surt.initial
  )
}


n.chains <- 3L


separate.inits <- lapply(
  seq_len(n.chains),
  create.separate.inits
)


# =============================================================================
# 11. FIT SEPARATE SURVIVAL MODEL
# =============================================================================

cat("\n")
cat("============================================================\n")
## ============================================================
cat("FITTING SEPARATE SURVIVAL MODEL\n")
## FITTING SEPARATE SURVIVAL MODEL
cat("============================================================\n")
## ============================================================
fit.separate <- R2WinBUGS::bugs(
  
  data =
    separate.data,
  
  inits =
    separate.inits,
  
  parameters.to.save =
    c("beta2"),
  
  model.file =
    separate.model.file,
  
  n.chains =
    3,
  
  n.iter =
    30000,
  
  n.burnin =
    10000,
  
  n.thin =
    5,
  
  bugs.directory =
    bugs.directory,
  
  working.directory =
    working.directory,
  
  DIC =
    TRUE,
  
  codaPkg =
    FALSE,
  
  debug =
    FALSE,
  
  clearWD =
    FALSE
)


cat("\nSeparate survival model completed.\n")
## 
## Separate survival model completed.
print(
  fit.separate$summary,
  digits = 5
)
##                 mean       sd        2.5%         25%        50%        75%
## beta2[1]   -3.728454 0.164124   -4.057025   -3.838000   -3.72600   -3.61500
## beta2[2]    0.207449 0.147355   -0.080291    0.108700    0.20730    0.30383
## beta2[3]   -0.156832 0.123685   -0.387700   -0.241625   -0.16045   -0.07610
## beta2[4]    0.622848 0.114574    0.401197    0.545200    0.62260    0.69930
## beta2[5]    0.084523 0.081567   -0.073471    0.029128    0.08386    0.13970
## deviance 1617.663917 3.237901 1613.000000 1615.000000 1617.00000 1619.00000
##                97.5%   Rhat n.eff
## beta2[1]   -3.417000 1.0012  6700
## beta2[2]    0.499405 1.0009 12000
## beta2[3]    0.095712 1.0009 12000
## beta2[4]    0.848802 1.0014  3800
## beta2[5]    0.247302 1.0010 12000
## deviance 1626.000000 1.0014  3600
saveRDS(
  fit.separate,
  file.path(
    working.directory,
    "Figure2_separate_survival_fit.rds"
  )
)


# =============================================================================
# 12. EXTRACT POSTERIOR SAMPLES
# =============================================================================

beta2.separate <- as.matrix(
  fit.separate$sims.list$beta2
)


beta2.joint <- as.matrix(
  fit.model.xi$sims.list$beta2
)


cat("\nNumber of separate-model posterior draws:\n")
## 
## Number of separate-model posterior draws:
print(
  nrow(beta2.separate)
)
## [1] 12000
cat("\nNumber of joint-model posterior draws:\n")
## 
## Number of joint-model posterior draws:
print(
  nrow(beta2.joint)
)
## [1] 30000
# =============================================================================
# 13. CHECK JOINT MODEL TREATMENT EFFECT
# =============================================================================

cat("\nModel XI beta2[2] treatment effect:\n")
## 
## Model XI beta2[2] treatment effect:
print(
  fit.model.xi$summary[
    "beta2[2]",
    c(
      "mean",
      "sd",
      "2.5%",
      "50%",
      "97.5%"
    )
  ],
  digits = 5
)
##      mean        sd      2.5%       50%     97.5% 
##  0.273873  0.184326 -0.083775  0.271200  0.638900
# =============================================================================
# 14. CALCULATE SEPARATE-MODEL LINEAR PREDICTORS
# =============================================================================

# ---------------------------------------------------------------------------
# ddI
# ---------------------------------------------------------------------------

eta.separate.ddI <-
  beta2.separate[, 1] +
  beta2.separate[, 2] * randgrp.ddI +
  beta2.separate[, 3] * gender.patient +
  beta2.separate[, 4] * prevoi.patient +
  beta2.separate[, 5] * stratum.patient


# ---------------------------------------------------------------------------
# ddC
# ---------------------------------------------------------------------------

eta.separate.ddC <-
  beta2.separate[, 1] +
  beta2.separate[, 2] * randgrp.ddC +
  beta2.separate[, 3] * gender.patient +
  beta2.separate[, 4] * prevoi.patient +
  beta2.separate[, 5] * stratum.patient


# =============================================================================
# 15. CALCULATE JOINT MODEL XI LINEAR PREDICTORS
# =============================================================================

# For this hypothetical patient:
#
# U1 = 0
# U2 = 0
#
# Therefore:
#
# r1*U1 + r2*U2 = 0
#
# The difference between separate and joint analyses comes from the
# posterior distribution of beta2 being estimated jointly with CD4.


# ---------------------------------------------------------------------------
# ddI
# ---------------------------------------------------------------------------

eta.joint.ddI <-
  beta2.joint[, 1] +
  beta2.joint[, 2] * randgrp.ddI +
  beta2.joint[, 3] * gender.patient +
  beta2.joint[, 4] * prevoi.patient +
  beta2.joint[, 5] * stratum.patient


# ---------------------------------------------------------------------------
# ddC
# ---------------------------------------------------------------------------

eta.joint.ddC <-
  beta2.joint[, 1] +
  beta2.joint[, 2] * randgrp.ddC +
  beta2.joint[, 3] * gender.patient +
  beta2.joint[, 4] * prevoi.patient +
  beta2.joint[, 5] * stratum.patient


# =============================================================================
# 16. CRITICAL DIAGNOSTIC CHECK
# =============================================================================

cat("\n")
cat("============================================================\n")
## ============================================================
cat("CHECKING ddI vs ddC CALCULATION\n")
## CHECKING ddI vs ddC CALCULATION
cat("============================================================\n")
## ============================================================
cat("\nFirst six joint-model calculations:\n")
## 
## First six joint-model calculations:
print(
  head(
    cbind(
      
      eta.ddI =
        eta.joint.ddI,
      
      eta.ddC =
        eta.joint.ddC,
      
      difference =
        eta.joint.ddI -
        eta.joint.ddC,
      
      beta2.2 =
        beta2.joint[, 2]
    )
  ),
  digits = 5
)
##      eta.ddI eta.ddC difference beta2.2
## [1,] -4.8272 -4.9604     0.1332  0.1332
## [2,] -5.0061 -5.1138     0.1077  0.1077
## [3,] -4.8308 -4.9734     0.1426  0.1426
## [4,] -5.1238 -4.9480    -0.1758 -0.1758
## [5,] -4.5295 -4.7415     0.2120  0.2120
## [6,] -4.6355 -5.0119     0.3764  0.3764
cat("\nCheck:\n")
## 
## Check:
print(
  all.equal(
    eta.joint.ddI -
      eta.joint.ddC,
    
    beta2.joint[, 2]
  )
)
## [1] TRUE
# This MUST return TRUE because:
#
# ddI = 1
# ddC = 0


# =============================================================================
# 17. CALCULATE POSTERIOR MEDIAN SURVIVAL TIMES
# =============================================================================

# Exponential survival:
#
# S(t) = exp(-lambda*t)
#
# S(t_median) = 0.5
#
# Therefore:
#
# t_median = log(2) / lambda
#
# lambda = exp(eta)


# Separate analysis

separate.ddI <-
  log(2) /
  exp(eta.separate.ddI)


separate.ddC <-
  log(2) /
  exp(eta.separate.ddC)


# Joint Model XI

joint.ddI <-
  log(2) /
  exp(eta.joint.ddI)


joint.ddC <-
  log(2) /
  exp(eta.joint.ddC)


# =============================================================================
# 18. CHECK THAT ddI AND ddC ARE DIFFERENT
# =============================================================================

cat("\n")
cat("============================================================\n")
## ============================================================
cat("TREATMENT COMPARISON CHECK\n")
## TREATMENT COMPARISON CHECK
cat("============================================================\n")
## ============================================================
cat("\nJoint ddI median survival:\n")
## 
## Joint ddI median survival:
print(
  summary(joint.ddI)
)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   34.80   69.06   81.36   84.77   96.69  252.11
cat("\nJoint ddC median survival:\n")
## 
## Joint ddC median survival:
print(
  summary(joint.ddC)
)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   44.14   89.84  106.93  111.86  128.48  333.21
cat("\nAre joint ddI and ddC identical?\n")
## 
## Are joint ddI and ddC identical?
print(
  isTRUE(
    all.equal(
      joint.ddI,
      joint.ddC
    )
  )
)
## [1] FALSE
# This should be FALSE.


# =============================================================================
# 19. MATHEMATICAL RATIO CHECK
# =============================================================================

# Since:
#
# ddI = 1
# ddC = 0
#
# eta_ddI - eta_ddC = beta2[2]
#
# therefore:
#
# median_ddC / median_ddI
#
# = exp(beta2[2])


joint.ratio <-
  joint.ddC /
  joint.ddI


cat("\nObserved posterior ratio ddC/ddI:\n")
## 
## Observed posterior ratio ddC/ddI:
print(
  summary(joint.ratio)
)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##  0.5705  1.1621  1.3115  1.3376  1.4869  2.7983
cat("\nExpected exp(beta2[2]):\n")
## 
## Expected exp(beta2[2]):
print(
  summary(
    exp(
      beta2.joint[, 2]
    )
  )
)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##  0.5705  1.1621  1.3115  1.3376  1.4869  2.7983
cat("\nRatio check:\n")
## 
## Ratio check:
print(
  all.equal(
    joint.ratio,
    exp(beta2.joint[, 2])
  )
)
## [1] TRUE
# This should return TRUE.


# =============================================================================
# 20. FUNCTION FOR POSTERIOR SURVIVAL SUMMARY
# =============================================================================

survival.summary <- function(x) {
  
  c(
    
    mean =
      mean(x),
    
    median =
      median(x),
    
    lower.95 =
      unname(
        quantile(
          x,
          0.025
        )
      ),
    
    upper.95 =
      unname(
        quantile(
          x,
          0.975
        )
      )
  )
}


# =============================================================================
# 21. CREATE FIGURE 2 SUMMARY TABLE
# =============================================================================

figure2.summary <- rbind(
  
  separate.ddI =
    survival.summary(
      separate.ddI
    ),
  
  separate.ddC =
    survival.summary(
      separate.ddC
    ),
  
  joint.ddI =
    survival.summary(
      joint.ddI
    ),
  
  joint.ddC =
    survival.summary(
      joint.ddC
    )
)


cat("\n")
cat("============================================================\n")
## ============================================================
cat("FIGURE 2 RESULTS\n")
## FIGURE 2 RESULTS
cat("============================================================\n")
## ============================================================
print(
  figure2.summary,
  digits = 5
)
##                 mean  median lower.95 upper.95
## separate.ddI  56.834  55.364   37.527   84.469
## separate.ddC  70.015  68.107   46.054  105.832
## joint.ddI     84.771  81.361   51.328  138.061
## joint.ddC    111.857 106.931   66.195  184.539
# =============================================================================
# 22. COMPARE WITH ORIGINAL PAPER/WORKSHOP VALUES
# =============================================================================

original.figure2 <- data.frame(
  
  analysis =
    c(
      "Separate",
      "Separate",
      "Joint",
      "Joint"
    ),
  
  treatment =
    c(
      "ddI",
      "ddC",
      "ddI",
      "ddC"
    ),
  
  original.median =
    c(
      55.4,
      68.0,
      81.4,
      106.8
    ),
  
  original.lower =
    c(
      37.4,
      46.4,
      51.2,
      64.8
    ),
  
  original.upper =
    c(
      85.0,
      106.3,
      134.7,
      178.5
    )
)


cat("\nOriginal Figure 2 values:\n")
## 
## Original Figure 2 values:
print(
  original.figure2
)
##   analysis treatment original.median original.lower original.upper
## 1 Separate       ddI            55.4           37.4           85.0
## 2 Separate       ddC            68.0           46.4          106.3
## 3    Joint       ddI            81.4           51.2          134.7
## 4    Joint       ddC           106.8           64.8          178.5
# =============================================================================
# 23. CREATE POSTERIOR DENSITIES
# =============================================================================

# IMPORTANT:
#
# Do NOT use:
#
#   from = 0
#
# The actual posterior median survival times are always positive.
#
# However, density() uses Gaussian kernel smoothing, so the estimated
# density curve may extend slightly below zero on the x-axis.
#
# This helps reproduce the appearance of Guo and Carlin Figure 2.


density.separate.ddI <- density(
  separate.ddI,
  n = 2048,
  adjust = 10
)


density.separate.ddC <- density(
  separate.ddC,
  n = 2048,
  adjust = 10
)


density.joint.ddI <- density(
  joint.ddI,
  n = 2048,
  adjust = 1.1
)


density.joint.ddC <- density(
  joint.ddC,
  n = 2048,
  adjust = 1.1
)


# =============================================================================
# 24. AXIS LIMITS TO MATCH GUO AND CARLIN FIGURE 2
# =============================================================================

# The posterior draws themselves cannot be negative.
#
# The small negative x-axis region is only produced by
# kernel density smoothing.

x.minimum <- 0
x.maximum <- 250

# Paper uses approximately 0.025 as maximum posterior density.

y.maximum <- 0.025


# =============================================================================
# 25. DRAW FIGURE 2
# =============================================================================

old.par <- par(
  no.readonly = TRUE
)


par(
  mfrow = c(2, 1),
  mar = c(4.2, 4.5, 3.0, 1.5),
  las = 1
)


# =============================================================================
# PANEL (a): SEPARATE ANALYSIS
# =============================================================================

plot(
  density.separate.ddI,
  
  xlim = c(
    x.minimum,
    x.maximum
  ),
  
  ylim = c(
    0,
    y.maximum
  ),
  
  lwd = 2,
  
  xlab = "Median survival time",
  
  ylab = "Posterior density",
  
  main = "(a) Separate analysis"
)


lines(
  density.separate.ddC,
  lwd = 2,
  lty = 2
)


legend(
  "topright",
  
  legend = c(
    
    sprintf(
      "ddI, median = %.1f, 95%% CrI = (%.1f, %.1f)",
      median(separate.ddI),
      quantile(separate.ddI, 0.025),
      quantile(separate.ddI, 0.975)
    ),
    
    sprintf(
      "ddC, median = %.1f, 95%% CrI = (%.1f, %.1f)",
      median(separate.ddC),
      quantile(separate.ddC, 0.025),
      quantile(separate.ddC, 0.975)
    )
  ),
  
  lty = c(1, 2),
  lwd = 2,
  bty = "n",
  cex = 0.75
)


# =============================================================================
# PANEL (b): JOINT ANALYSIS — MODEL XI
# =============================================================================

plot(
  density.joint.ddI,
  
  xlim = c(
    x.minimum,
    x.maximum
  ),
  
  ylim = c(
    0,
    y.maximum
  ),
  
  lwd = 2,
  
  xlab = "Median survival time",
  
  ylab = "Posterior density",
  
  main = "(b) Joint analysis — Model XI"
)


lines(
  density.joint.ddC,
  lwd = 2,
  lty = 2
)


legend(
  "topright",
  
  legend = c(
    
    sprintf(
      "ddI, median = %.1f, 95%% CrI = (%.1f, %.1f)",
      median(joint.ddI),
      quantile(joint.ddI, 0.025),
      quantile(joint.ddI, 0.975)
    ),
    
    sprintf(
      "ddC, median = %.1f, 95%% CrI = (%.1f, %.1f)",
      median(joint.ddC),
      quantile(joint.ddC, 0.025),
      quantile(joint.ddC, 0.975)
    )
  ),
  
  lty = c(1, 2),
  lwd = 2,
  bty = "n",
  cex = 0.75
)

Mathematical Summary of Guo and Carlin Figure 2(a) and Figure 2(b)

  • Figure 2(a): a separate survival analysis;
  • Figure 2(b): a joint longitudinal-survival analysis using Model XI.

The hypothetical patient is:

\[ Gender_i = 1, \]

\[ PrevOI_i = -1, \]

and

\[ Stratum_i = -1. \]

These correspond to:

  • male;
  • AIDS-negative at study entry;
  • intolerant of AZT.

Treatment is coded as

\[ Drug_i = \begin{cases} 1, & \text{ddI},\\ 0, & \text{ddC}. \end{cases} \]

Exponential Survival Model

The survival model used for Figure 2 is exponential.

Therefore,

\[ T_i \sim \text{Exponential}(\lambda_i), \]

with survival function

\[ S_i(t) = \exp(-\lambda_i t). \]

The median survival time \(M_i\) is defined by

\[ S_i(M_i) = 0.5. \]

Hence,

\[ \exp(-\lambda_i M_i) = 0.5. \]

Taking logarithms gives

\[ -\lambda_i M_i = \log(0.5) = -\log(2). \]

Therefore,

\[ \boxed{ M_i = \frac{\log(2)}{\lambda_i} } \]

Since

\[ \lambda_i = \exp(\eta_i), \]

we have

\[ \boxed{ M_i = \frac{\log(2)}{\exp(\eta_i)} = \log(2)\exp(-\eta_i) } \]

This is the formula used to calculate the posterior median survival time at each MCMC iteration.

Figure 2(a): Separate Survival Analysis

In the separate survival model,

\[ \eta_i = \beta_{21} + \beta_{22}Drug_i + \beta_{23}Gender_i + \beta_{24}PrevOI_i + \beta_{25}Stratum_i. \]

For the hypothetical patient,

\[ Gender_i=1, \qquad PrevOI_i=-1, \qquad Stratum_i=-1. \]

Therefore,

\[ \eta_i = \beta_{21} + \beta_{22}Drug_i + \beta_{23} - \beta_{24} - \beta_{25}. \]

ddC

For ddC,

\[ Drug_i=0. \]

Therefore,

\[ \eta_{\mathrm{ddC}} = \beta_{21} + \beta_{23} - \beta_{24} - \beta_{25}. \]

Hence,

\[ \boxed{ M_{\mathrm{ddC}} = \log(2) \exp \left( -\beta_{21} -\beta_{23} +\beta_{24} +\beta_{25} \right) } \]

ddI

For ddI,

\[ Drug_i=1. \]

Therefore,

\[ \eta_{\mathrm{ddI}} = \beta_{21} + \beta_{22} + \beta_{23} - \beta_{24} - \beta_{25}. \]

Hence,

\[ \boxed{ M_{\mathrm{ddI}} = \log(2) \exp \left( -\beta_{21} -\beta_{22} -\beta_{23} +\beta_{24} +\beta_{25} \right) } \]

Treatment Ratio in Figure 2(a)

The ratio of median survival times is

\[ \frac{M_{\mathrm{ddC}}} {M_{\mathrm{ddI}}} = \exp(\beta_{22}). \]

Therefore,

\[ \boxed{ \frac{M_{\mathrm{ddC}}} {M_{\mathrm{ddI}}} = e^{\beta_{22}} } \]

If

\[ \beta_{22}>0, \]

then ddI has a higher hazard than ddC, so

\[ M_{\mathrm{ddC}} > M_{\mathrm{ddI}}. \]

This is the pattern shown in Figure 2(a).

Figure 2(b): Joint Analysis Using Model XI

For Model XI, the survival linear predictor is

\[ \eta_i = X_{2i}^T\beta_2 + \gamma_1U_{1i} + \gamma_2U_{2i}. \]

Equivalently,

\[ \eta_i = \beta_{21} + \beta_{22}Drug_i + \beta_{23}Gender_i + \beta_{24}PrevOI_i + \beta_{25}Stratum_i + \gamma_1U_{1i} + \gamma_2U_{2i}. \]

Here,

\[ U_{1i} \]

is the subject-specific longitudinal random intercept, and

\[ U_{2i} \]

is the subject-specific longitudinal random slope.

The terms

\[ \gamma_1U_{1i} \]

and

\[ \gamma_2U_{2i} \]

link the longitudinal CD4 process with the survival process.

Hypothetical Patient in Figure 2(b)

For the hypothetical patient in Figure 2, there are no patient-specific longitudinal CD4 observations from which to estimate individual random effects.

Therefore, the calculation corresponds to using the population-average random effects:

\[ U_{1i}=0, \qquad U_{2i}=0. \]

Hence,

\[ \gamma_1U_{1i} + \gamma_2U_{2i} = 0. \]

The survival linear predictor therefore becomes

\[ \eta_i = X_{2i}^T\beta_2. \]

Thus, the mathematical form of the median survival calculation is the same as in the separate model:

\[ \boxed{ M_i^{Joint} = \frac{\log(2)} {\exp(X_{2i}^T\beta_2^{Joint})} } \]

or

\[ \boxed{ M_i^{Joint} = \log(2) \exp \left( -X_{2i}^T\beta_2^{Joint} \right) } \]

The important difference is that the posterior distribution of

\[ \beta_2^{Joint} \]

comes from the full joint longitudinal-survival model rather than from the survival model alone.

Joint Model ddC

For ddC,

\[ Drug_i=0. \]

Therefore,

\[ \eta_{\mathrm{ddC}}^{Joint} = \beta_{21}^{J} + \beta_{23}^{J} - \beta_{24}^{J} - \beta_{25}^{J}. \]

Hence,

\[ \boxed{ M_{\mathrm{ddC}}^{Joint} = \log(2) \exp \left( -\beta_{21}^{J} -\beta_{23}^{J} +\beta_{24}^{J} +\beta_{25}^{J} \right) } \]

Joint Model ddI

For ddI,

\[ Drug_i=1. \]

Therefore,

\[ \eta_{\mathrm{ddI}}^{Joint} = \beta_{21}^{J} + \beta_{22}^{J} + \beta_{23}^{J} - \beta_{24}^{J} - \beta_{25}^{J}. \]

Hence,

\[ \boxed{ M_{\mathrm{ddI}}^{Joint} = \log(2) \exp \left( -\beta_{21}^{J} -\beta_{22}^{J} -\beta_{23}^{J} +\beta_{24}^{J} +\beta_{25}^{J} \right) } \]

Treatment Ratio in Figure 2(b)

Again,

\[ \frac{ M_{\mathrm{ddC}}^{Joint} }{ M_{\mathrm{ddI}}^{Joint} } = \exp(\beta_{22}^{J}). \]

Therefore,

\[ \boxed{ \frac{ M_{\mathrm{ddC}}^{Joint} }{ M_{\mathrm{ddI}}^{Joint} } = e^{\beta_{22}^{J}} } \]

Why Figure 2(b) Shifts to the Right

The crucial difference between Figure 2(a) and Figure 2(b) is not the formula for the median survival time.

Both use

\[ M = \frac{\log(2)} {\exp(\eta)}. \]

The difference is how the posterior distribution of the survival regression coefficients is estimated.

For the separate survival analysis,

\[ p(\beta_2 \mid T,\delta) \]

is estimated using the survival information only.

For the joint analysis,

\[ p( \beta_1, \beta_2, U, \gamma \mid Y,T,\delta ) \]

is estimated using the longitudinal CD4 data and survival data simultaneously.

Therefore,

\[ p( \beta_2 \mid \text{joint longitudinal-survival data} ) \]

may differ substantially from

\[ p( \beta_2 \mid \text{survival data only} ). \]

This changes the posterior distribution of

\[ \eta_i \]

and consequently changes the posterior distribution of

\[ M_i = \log(2)\exp(-\eta_i). \]

In Guo and Carlin’s analysis, the joint model produced lower estimated hazards for this hypothetical good-prognosis patient.

Therefore,

\[ \lambda_i^{Joint} < \lambda_i^{Separate}, \]

and hence,

\[ \boxed{ M_i^{Joint} > M_i^{Separate} } \]

This explains why the posterior density curves in Figure 2(b) are shifted substantially to the right relative to Figure 2(a).

Posterior Calculation Using MCMC

At MCMC iteration \(k\), the model produces a posterior draw

\[ \beta_2^{(k)}. \]

The corresponding linear predictor is

\[ \eta_i^{(k)} = X_i^T\beta_2^{(k)}. \]

The posterior median survival time for that iteration is then

\[ M_i^{(k)} = \frac{\log(2)} {\exp(\eta_i^{(k)})}. \]

After \(K\) MCMC iterations, we obtain

\[ M_i^{(1)}, M_i^{(2)}, \ldots, M_i^{(K)}. \]

These draws form the posterior distribution of median survival time:

\[ \boxed{ p(M_i\mid\text{data}) } \]

Figure 2 plots a smoothed estimate of this posterior distribution.

Posterior Median and 95% Credible Interval

The posterior median is

\[ \operatorname{median} \left\{ M_i^{(1)}, M_i^{(2)}, \ldots, M_i^{(K)} \right\}. \]

The 95% posterior credible interval is

\[ \boxed{ \left[ Q_{0.025}(M_i), Q_{0.975}(M_i) \right] } \]

where

\[ Q_{0.025} \]

and

\[ Q_{0.975} \]

are the 2.5th and 97.5th percentiles of the posterior draws.

Why the Density Curve Can Extend Below Zero in Figure 2(a)

Every actual posterior draw of median survival satisfies

\[ M_i^{(k)} = \frac{\log(2)} {\exp(\eta_i^{(k)})} >0. \]

Therefore,

\[ \boxed{ M_i^{(k)}>0 } \]

for every MCMC iteration.

However, Figure 2 displays a kernel density estimate rather than the raw posterior draws.

A kernel density estimate has the form

\[ \hat f(m) = \frac{1}{Kh} \sum_{k=1}^{K} K \left( \frac{m-M_i^{(k)}}{h} \right), \]

where

\[ h \]

is the smoothing bandwidth and \(K(\cdot)\) is the kernel function.

With a Gaussian kernel, the kernel has support over the entire real line:

\[ (-\infty,\infty). \]

Therefore, the estimated density curve can extend slightly below zero even when every actual posterior survival-time draw is positive.

Thus,

\[ \boxed{ \text{negative x-values in the smoothed density} \neq \text{negative median survival times} } \]

The negative portion is only a kernel-smoothing artifact.

Why Figure 2(b) May Not Extend Below Zero

The posterior median survival distributions in Figure 2(b) are shifted farther to the right than those in Figure 2(a).

Therefore, the minimum joint-model posterior draws are farther from zero.

With the same or similar kernel smoothing, the left tail of the kernel density may remain entirely above zero.

Thus, it is perfectly reasonable for Figure 2(a) to show a small negative-x KDE tail while Figure 2(b) does not.

This does not indicate any difference in the mathematical support of the median survival time.

In both cases,

\[ \boxed{ M_i>0 } \]

mathematically.

Final Mathematical Summary

Figure 2(a) is based on

\[ \boxed{ M_i^{Separate} = \log(2) \exp \left( -X_i^T\beta_2^{Separate} \right) } \]

where

\[ \beta_2^{Separate} \]

is estimated from the survival model alone.

Figure 2(b) is based on

\[ \boxed{ M_i^{Joint} = \log(2) \exp \left( -X_i^T\beta_2^{Joint} \right) } \]

for the hypothetical patient with

\[ U_{1i}=U_{2i}=0, \]

where

\[ \beta_2^{Joint} \]

is estimated jointly with the longitudinal CD4 model.

Therefore, the main conceptual distinction is

\[ \boxed{ \text{Figure 2(a)} = \text{survival-only posterior inference} } \]

versus

\[ \boxed{ \text{Figure 2(b)} = \text{joint CD4-survival posterior inference} } \]

The joint model uses information from both the longitudinal and survival processes, which changes the posterior distribution of the survival regression parameters and leads to the substantially longer estimated median survival times shown in Figure 2(b).

R code to reproduce Table 3.

# =============================================================================
# GUO & CARLIN (2004)
# TABLE 3: BAYESIAN SEPARATE ANALYSIS
#
# TWO COMPLETELY SEPARATE WINBUGS MODELS
#
# Model A: Longitudinal CD4 model
# Model B: Survival model
#
# There is NO sharing of random effects between the models.
#
# Longitudinal:
#   beta11 + beta12*time + beta13*time*drug
#   + beta14*gender + beta15*prevOI + beta16*AZT
#   + U1 + U2*time
#
# Survival:
#   beta21 + beta22*drug + beta23*gender
#   + beta24*prevOI + beta25*AZT
#
# NO r1*U1 + r2*U2 terms.
#
# CD4 in JMbayes2::aids is used directly here.
# Do NOT apply sqrt(CD4) again.
# =============================================================================


# =============================================================================
# 2. LOAD DATA
# =============================================================================

data(
  "aids",
  package = "JMbayes2"
)

data(
  "aids.id",
  package = "JMbayes2"
)


cat(
  "\nDimensions:\n"
)
## 
## Dimensions:
cat(
  "aids    =",
  nrow(aids),
  "rows\n"
)
## aids    = 1405 rows
cat(
  "aids.id =",
  nrow(aids.id),
  "subjects\n\n"
)
## aids.id = 467 subjects
# =============================================================================
# 3. CHECK ORIGINAL VARIABLES
# =============================================================================

str(aids)
## 'data.frame':    1405 obs. of  12 variables:
##  $ patient: Factor w/ 467 levels "1","2","3","4",..: 1 1 1 2 2 2 2 3 3 3 ...
##  $ Time   : num  17 17 17 19 19 ...
##  $ death  : int  0 0 0 0 0 0 0 1 1 1 ...
##  $ CD4    : num  10.68 8.43 9.43 6.32 8.12 ...
##  $ obstime: int  0 6 12 0 6 12 18 0 2 6 ...
##  $ drug   : Factor w/ 2 levels "ddC","ddI": 1 1 1 2 2 2 2 2 2 2 ...
##  $ gender : Factor w/ 2 levels "female","male": 2 2 2 2 2 2 2 1 1 1 ...
##  $ prevOI : Factor w/ 2 levels "noAIDS","AIDS": 2 2 2 1 1 1 1 2 2 2 ...
##  $ AZT    : Factor w/ 2 levels "intolerance",..: 1 1 1 1 1 1 1 1 1 1 ...
##  $ start  : int  0 6 12 0 6 12 18 0 2 6 ...
##  $ stop   : num  6 12 17 6 12 ...
##  $ event  : num  0 0 0 0 0 0 0 0 0 1 ...
str(aids.id)
## 'data.frame':    467 obs. of  12 variables:
##  $ patient: Factor w/ 467 levels "1","2","3","4",..: 1 2 3 4 5 6 7 8 9 10 ...
##  $ Time   : num  17 19 18.5 12.7 15.1 ...
##  $ death  : int  0 0 1 0 0 1 0 1 1 0 ...
##  $ CD4    : num  10.68 6.32 3.46 3.87 7.28 ...
##  $ obstime: int  0 0 0 0 0 0 0 0 0 0 ...
##  $ drug   : Factor w/ 2 levels "ddC","ddI": 1 2 2 1 2 1 1 2 1 2 ...
##  $ gender : Factor w/ 2 levels "female","male": 2 2 1 2 2 1 2 1 2 2 ...
##  $ prevOI : Factor w/ 2 levels "noAIDS","AIDS": 2 1 2 2 2 2 2 1 2 2 ...
##  $ AZT    : Factor w/ 2 levels "intolerance",..: 1 1 1 2 2 2 1 1 2 1 ...
##  $ start  : int  0 0 0 0 0 0 0 0 0 0 ...
##  $ stop   : num  6 6 2 2 2 1.9 2 2 2 2 ...
##  $ event  : num  0 0 0 0 0 1 0 0 0 0 ...
cat(
  "\nDrug:\n"
)
## 
## Drug:
print(
  table(aids.id$drug)
)
## 
## ddC ddI 
## 237 230
cat(
  "\nGender:\n"
)
## 
## Gender:
print(
  table(aids.id$gender)
)
## 
## female   male 
##     45    422
cat(
  "\nPrevious OI:\n"
)
## 
## Previous OI:
print(
  table(aids.id$prevOI)
)
## 
## noAIDS   AIDS 
##    160    307
cat(
  "\nAZT stratum:\n"
)
## 
## AZT stratum:
print(
  table(aids.id$AZT)
)
## 
## intolerance     failure 
##         292         175
cat(
  "\nDeath:\n"
)
## 
## Death:
print(
  table(aids.id$death)
)
## 
##   0   1 
## 279 188
# =============================================================================
# 4. CREATE SUBJECT INDEX
# =============================================================================

aids$patient.original <-
  as.character(
    aids$patient
  )


aids.id$patient.original <-
  as.character(
    aids.id$patient
  )


N <- nrow(aids.id)


aids.id$id <-
  seq_len(N)


aids$id <-
  match(
    aids$patient.original,
    aids.id$patient.original
  )


if (anyNA(aids$id)) {
  
  stop(
    "Some longitudinal patient IDs could not be matched to aids.id."
  )
}


# =============================================================================
# 5. CREATE GUO-CARLIN COVARIATES
# =============================================================================
#
# Drug:
#       ddC = 0
#       ddI = 1
#
# Effect coding:
#
# Gender:
#       female = -1
#       male   =  1
#
# Previous opportunistic infection:
#       no AIDS = -1
#       AIDS    =  1
#
# AZT:
#       intolerance = -1
#       failure     =  1
#
# =============================================================================

aids.id <- aids.id %>%
  
  mutate(
    
    randgrp1 =
      ifelse(
        as.character(drug) == "ddI",
        1,
        0
      ),
    
    
    gender1 =
      ifelse(
        as.character(gender) == "male",
        1,
        -1
      ),
    
    
    prevoi1 =
      ifelse(
        as.character(prevOI) == "AIDS",
        1,
        -1
      ),
    
    
    stratum1 =
      ifelse(
        as.character(AZT) == "failure",
        1,
        -1
      ),
    
    
    event =
      as.integer(death)
  )


# =============================================================================
# 6. CHECK CODING
# =============================================================================

cat(
  "\nDrug coding:\n"
)
## 
## Drug coding:
print(
  table(
    aids.id$drug,
    aids.id$randgrp1
  )
)
##      
##         0   1
##   ddC 237   0
##   ddI   0 230
cat(
  "\nGender coding:\n"
)
## 
## Gender coding:
print(
  table(
    aids.id$gender,
    aids.id$gender1
  )
)
##         
##           -1   1
##   female  45   0
##   male     0 422
cat(
  "\nPrevOI coding:\n"
)
## 
## PrevOI coding:
print(
  table(
    aids.id$prevOI,
    aids.id$prevoi1
  )
)
##         
##           -1   1
##   noAIDS 160   0
##   AIDS     0 307
cat(
  "\nAZT coding:\n"
)
## 
## AZT coding:
print(
  table(
    aids.id$AZT,
    aids.id$stratum1
  )
)
##              
##                -1   1
##   intolerance 292   0
##   failure       0 175
# =============================================================================
# 7. PREPARE LONGITUDINAL DATA
# =============================================================================
#
# IMPORTANT:
#
# JMbayes2 AIDS data are being used on their existing CD4 scale.
#
# DO NOT use:
#
#     sqrt(CD4)
#
# =============================================================================

aids.long <- aids %>%
  
  filter(
    !is.na(CD4),
    !is.na(obstime),
    !is.na(id)
  ) %>%
  
  arrange(
    id,
    obstime
  )


Nlong <-
  nrow(aids.long)


Y <-
  as.numeric(
    aids.long$CD4
  )


time <-
  as.numeric(
    aids.long$obstime
  )


id.long <-
  as.integer(
    aids.long$id
  )

cat(
  "LONGITUDINAL DATA\n"
)
## LONGITUDINAL DATA
cat(
  "Subjects               =",
  N,
  "\n"
)
## Subjects               = 467
cat(
  "Longitudinal records   =",
  Nlong,
  "\n"
)
## Longitudinal records   = 1405
cat(
  "CD4 range              =",
  range(Y),
  "\n"
)
## CD4 range              = 0 24.12468
cat(
  "Time range             =",
  range(time),
  "\n\n"
)
## Time range             = 0 18
# =============================================================================
# 8. PREPARE SUBJECT-LEVEL COVARIATES
# =============================================================================

randgrp1 <-
  as.numeric(
    aids.id$randgrp1
  )


gender1 <-
  as.numeric(
    aids.id$gender1
  )


prevoi1 <-
  as.numeric(
    aids.id$prevoi1
  )


stratum1 <-
  as.numeric(
    aids.id$stratum1
  )


# =============================================================================
# 9. PRIORS FOR LONGITUDINAL MODEL
# =============================================================================
#
# Original Guo-Carlin prior structure:
#
# beta1 ~ MVN(0, precision = 0.01 I)
#
# tau ~ Wishart(R, 23)
#
# R = diag(100, 2)
#
# tauz ~ Gamma(0.1, 0.1)
#
# =============================================================================

betamu1 <-
  rep(
    0,
    6
  )


Sigma1 <-
  diag(
    0.01,
    6
  )


U0 <-
  c(
    0,
    0
  )


R <-
  diag(
    100,
    2
  )


# =============================================================================
# 10. LONGITUDINAL WINBUGS DATA
# =============================================================================

winbugs.data.long <- list(
  
  N = N,
  
  Nlong = Nlong,
  
  Y = Y,
  
  time = time,
  
  id.long = id.long,
  
  randgrp1 = randgrp1,
  
  gender1 = gender1,
  
  prevoi1 = prevoi1,
  
  stratum1 = stratum1,
  
  U0 = U0,
  
  R = R,
  
  betamu1 = betamu1,
  
  Sigma1 = Sigma1
)


# =============================================================================
# 11. LONGITUDINAL WINBUGS MODEL
# =============================================================================

winbugs.model.long <- "
model {

  # ---------------------------------------------------------------------------
  # LONGITUDINAL CD4 LIKELIHOOD
  # ---------------------------------------------------------------------------

  for (k in 1:Nlong) {

    Y[k] ~ dnorm(
      muy[k],
      tauz
    )

    muy[k] <-
        beta1[1]
      + beta1[2] * time[k]
      + beta1[3] * time[k] * randgrp1[id.long[k]]
      + beta1[4] * gender1[id.long[k]]
      + beta1[5] * prevoi1[id.long[k]]
      + beta1[6] * stratum1[id.long[k]]
      + U[id.long[k],1]
      + U[id.long[k],2] * time[k]
  }


  # ---------------------------------------------------------------------------
  # RANDOM INTERCEPT + RANDOM SLOPE
  # ---------------------------------------------------------------------------

  for (i in 1:N) {

    U[i,1:2] ~ dmnorm(
      U0[],
      tau[,]
    )

  }


  # ---------------------------------------------------------------------------
  # RANDOM-EFFECT PRECISION MATRIX
  # ---------------------------------------------------------------------------

  tau[1:2,1:2] ~ dwish(
    R[,],
    23
  )


  # ---------------------------------------------------------------------------
  # RANDOM-EFFECT VARIANCE-COVARIANCE MATRIX
  # ---------------------------------------------------------------------------

  sigma[1:2,1:2] <-
    inverse(
      tau[,]
    )


  sigma1 <-
    sigma[1,1]

  sigma2 <-
    sigma[2,2]

  sigma12 <-
    sigma[1,2]


  cor <-
    sigma12 /
    sqrt(
      sigma1 * sigma2
    )


  # ---------------------------------------------------------------------------
  # RESIDUAL PRECISION / VARIANCE
  # ---------------------------------------------------------------------------

  tauz ~ dgamma(
    0.1,
    0.1
  )


  sigmaz <-
    1 / tauz


  # ---------------------------------------------------------------------------
  # FIXED-EFFECT PRIOR
  # ---------------------------------------------------------------------------

  beta1[1:6] ~ dmnorm(
    betamu1[],
    Sigma1[,]
  )

}
"


# =============================================================================
# 12. WRITE LONGITUDINAL MODEL FILE
# =============================================================================

model.file.long <- file.path(
  working.directory,
  "Table3_Separate_Longitudinal.txt"
)


writeLines(
  winbugs.model.long,
  model.file.long
)


# =============================================================================
# 13. LONGITUDINAL INITIAL VALUES
# =============================================================================

set.seed(
  20260725
)


long.inits <- function(chain) {
  
  set.seed(
    1000 + chain
  )
  
  
  list(
    
    beta1 =
      rnorm(
        6,
        0,
        0.1
      ),
    
    
    tauz =
      rgamma(
        1,
        shape = 1,
        rate = 1
      )
  )
}


n.chains <- 3


inits.long <-
  lapply(
    1:n.chains,
    long.inits
  )


# =============================================================================
# 14. LONGITUDINAL PARAMETERS TO SAVE
# =============================================================================

parameters.long <- c(
  
  "beta1",
  
  "sigma1",
  
  "sigma2",
  
  "sigma12",
  
  "cor",
  
  "sigmaz"
)


# =============================================================================
# 15. RUN LONGITUDINAL MODEL
# =============================================================================


cat(
  "RUNNING TABLE 3 SEPARATE LONGITUDINAL MODEL\n"
)
## RUNNING TABLE 3 SEPARATE LONGITUDINAL MODEL
fit.long <- bugs(
  
  data =
    winbugs.data.long,
  
  inits =
    inits.long,
  
  parameters.to.save =
    parameters.long,
  
  model.file =
    model.file.long,
  
  n.chains =
    n.chains,
  
  n.iter =
    10000,
  
  n.burnin =
    2000,
  
  n.thin =
    2,
  
  bugs.directory =
    bugs.directory,
  
  working.directory =
    working.directory,
  
  DIC =
    TRUE,
  
  codaPkg =
    FALSE,
  
  debug =
    FALSE,
  
  clearWD =
    FALSE
)


# =============================================================================
# 16. PRINT LONGITUDINAL RESULTS
# =============================================================================


cat(
  "LONGITUDINAL MODEL RESULTS\n"
)
## LONGITUDINAL MODEL RESULTS
print(
  fit.long,
  digits = 4
)
## Inference for Bugs model at "D:/Joint_model/winBUGS/Table3_Separate_Longitudinal.txt", fit using WinBUGS,
##  3 chains, each with 10000 iterations (first 2000 discarded), n.thin = 2
##  n.sims = 12000 iterations saved
##               mean      sd      2.5%       25%       50%       75%     97.5%
## beta1[1]    8.0516  0.3422    7.3520    7.8320    8.0560    8.2780    8.7220
## beta1[2]   -0.1955  0.0489   -0.2937   -0.2282   -0.1946   -0.1628   -0.0992
## beta1[3]    0.0506  0.0706   -0.0846    0.0011    0.0491    0.0992    0.1907
## beta1[4]   -0.1566  0.3192   -0.7828   -0.3725   -0.1560    0.0552    0.4773
## beta1[5]   -2.3344  0.2324   -2.7870   -2.4940   -2.3350   -2.1800   -1.8700
## beta1[6]   -0.0934  0.2343   -0.5479   -0.2545   -0.0918    0.0620    0.3706
## sigma1     15.5728  1.1256   13.5300   14.7900   15.5100   16.3100   17.9502
## sigma2      0.3914  0.0303    0.3356    0.3701    0.3902    0.4109    0.4550
## sigma12    -0.2751  0.1382   -0.5482   -0.3669   -0.2725   -0.1806   -0.0104
## cor        -0.1110  0.0542   -0.2142   -0.1483   -0.1113   -0.0739   -0.0042
## sigmaz      2.8941  0.1607    2.5930    2.7840    2.8890    2.9970    3.2240
## deviance 5477.5991 57.9221 5368.0000 5438.0000 5476.0000 5517.0000 5592.0000
##            Rhat n.eff
## beta1[1] 1.0025  1200
## beta1[2] 1.0152   150
## beta1[3] 1.0085   290
## beta1[4] 1.0047   530
## beta1[5] 1.0012  6600
## beta1[6] 1.0080   280
## sigma1   1.0009 12000
## sigma2   1.0011  9700
## sigma12  1.0013  5200
## cor      1.0012  5800
## sigmaz   1.0013  5200
## deviance 1.0010 12000
## 
## For each parameter, n.eff is a crude measure of effective sample size,
## and Rhat is the potential scale reduction factor (at convergence, Rhat=1).
## 
## DIC info (using the rule, pD = Dbar-Dhat)
## pD = 728.9 and DIC = 6206.5
## DIC is an estimate of expected predictive error (lower deviance is better).
# =============================================================================
# 17. EXTRACT LONGITUDINAL TABLE
# =============================================================================

long.names <- c(
  
  paste0(
    "beta1[",
    1:6,
    "]"
  ),
  
  "sigma1",
  
  "sigma2",
  
  "sigma12",
  
  "cor",
  
  "sigmaz"
)


long.results <-
  fit.long$summary[
    long.names,
    ,
    drop = FALSE
  ]


print(
  long.results,
  digits = 4
)
##              mean      sd     2.5%       25%      50%      75%     97.5%  Rhat
## beta1[1]  8.05161 0.34218  7.35197  7.832000  8.05600  8.27800  8.722050 1.002
## beta1[2] -0.19548 0.04895 -0.29371 -0.228200 -0.19460 -0.16280 -0.099179 1.015
## beta1[3]  0.05057 0.07058 -0.08457  0.001094  0.04906  0.09920  0.190700 1.008
## beta1[4] -0.15664 0.31918 -0.78282 -0.372525 -0.15600  0.05518  0.477300 1.005
## beta1[5] -2.33440 0.23241 -2.78700 -2.494000 -2.33500 -2.18000 -1.869975 1.001
## beta1[6] -0.09343 0.23428 -0.54790 -0.254500 -0.09182  0.06197  0.370602 1.008
## sigma1   15.57279 1.12557 13.53000 14.790000 15.51000 16.31000 17.950250 1.001
## sigma2    0.39141 0.03033  0.33560  0.370100  0.39020  0.41090  0.455000 1.001
## sigma12  -0.27513 0.13821 -0.54821 -0.366925 -0.27250 -0.18058 -0.010379 1.001
## cor      -0.11103 0.05425 -0.21420 -0.148300 -0.11130 -0.07392 -0.004153 1.001
## sigmaz    2.89412 0.16067  2.59300  2.784000  2.88900  2.99700  3.224000 1.001
##          n.eff
## beta1[1]  1200
## beta1[2]   150
## beta1[3]   290
## beta1[4]   530
## beta1[5]  6600
## beta1[6]   280
## sigma1   12000
## sigma2    9700
## sigma12   5200
## cor       5800
## sigmaz    5200
# =============================================================================
# 18. SAVE LONGITUDINAL MODEL
# =============================================================================

saveRDS(
  
  fit.long,
  
  file.path(
    working.directory,
    "Table3_Separate_Longitudinal_fit.rds"
  )
)


# =============================================================================
# =============================================================================
#
# PART B
#
# SURVIVAL MODEL ONLY
#
# =============================================================================
# =============================================================================


# =============================================================================
# 19. PREPARE SURVIVAL DATA
# =============================================================================

event <-
  as.integer(
    aids.id$event
  )


survival.time <-
  as.numeric(
    aids.id$Time
  )


# =============================================================================
# 20. WINBUGS CENSORING FORMAT
# =============================================================================
#
# Event:
#
#       surt = observed death time
#       surt.cen = 0
#
# Censored:
#
#       surt = NA
#       surt.cen = censoring time
#
# =============================================================================

surt <-
  ifelse(
    event == 1,
    survival.time,
    NA_real_
  )


surt.cen <-
  ifelse(
    event == 0,
    survival.time,
    0
  )


cat(
  "SURVIVAL DATA\n"
)
## SURVIVAL DATA
cat(
  "Subjects  =",
  N,
  "\n"
)
## Subjects  = 467
cat(
  "Deaths    =",
  sum(event == 1),
  "\n"
)
## Deaths    = 188
cat(
  "Censored  =",
  sum(event == 0),
  "\n"
)
## Censored  = 279
cat(
  "Follow-up range =",
  range(survival.time),
  "\n\n"
)
## Follow-up range = 0.47 21.4
# =============================================================================
# 21. PRIORS FOR SURVIVAL MODEL
# =============================================================================

betamu2 <-
  rep(
    0,
    5
  )


Sigma2 <-
  diag(
    0.01,
    5
  )


# =============================================================================
# 22. SURVIVAL WINBUGS DATA
# =============================================================================

winbugs.data.surv <- list(
  
  N = N,
  
  surt = surt,
  
  surt.cen = surt.cen,
  
  randgrp1 = randgrp1,
  
  gender1 = gender1,
  
  prevoi1 = prevoi1,
  
  stratum1 = stratum1,
  
  betamu2 = betamu2,
  
  Sigma2 = Sigma2
)


# =============================================================================
# 23. SURVIVAL WINBUGS MODEL
# =============================================================================
#
# Weibull shape = 1
#
# Therefore this is an exponential survival model.
#
# IMPORTANT:
#
# NO:
#
#     r1 * U[i,1]
#
# NO:
#
#     r2 * U[i,2]
#
# =============================================================================

winbugs.model.surv <- "
model {

  # ---------------------------------------------------------------------------
  # SURVIVAL LIKELIHOOD
  # ---------------------------------------------------------------------------

  for (i in 1:N) {

    surt[i] ~ dweib(
      1,
      mut[i]
    ) I(surt.cen[i], )

    log(mut[i]) <-
        beta2[1]
      + beta2[2] * randgrp1[i]
      + beta2[3] * gender1[i]
      + beta2[4] * prevoi1[i]
      + beta2[5] * stratum1[i]

  }


  # ---------------------------------------------------------------------------
  # FIXED-EFFECT PRIOR
  # ---------------------------------------------------------------------------

  beta2[1:5] ~ dmnorm(
    betamu2[],
    Sigma2[,]
  )

}
"


# =============================================================================
# 24. WRITE SURVIVAL MODEL FILE
# =============================================================================

model.file.surv <- file.path(
  working.directory,
  "Table3_Separate_Survival.txt"
)


writeLines(
  winbugs.model.surv,
  model.file.surv
)


# =============================================================================
# 25. SURVIVAL INITIAL VALUES
# =============================================================================

surv.inits <- function(chain) {
  
  set.seed(
    2000 + chain
  )
  
  
  list(
    
    beta2 =
      c(
        -3.5,
        rnorm(
          4,
          mean = 0,
          sd = 0.1
        )
      )
  )
}


inits.surv <-
  lapply(
    1:n.chains,
    surv.inits
  )


# =============================================================================
# 26. PARAMETERS TO SAVE
# =============================================================================

parameters.surv <- c(
  "beta2"
)


# =============================================================================
# 27. RUN SURVIVAL MODEL
# =============================================================================


cat(
  "RUNNING TABLE 3 SEPARATE SURVIVAL MODEL\n"
)
## RUNNING TABLE 3 SEPARATE SURVIVAL MODEL
fit.surv <- bugs(
  
  data =
    winbugs.data.surv,
  
  inits =
    inits.surv,
  
  parameters.to.save =
    parameters.surv,
  
  model.file =
    model.file.surv,
  
  n.chains =
    n.chains,
  
  n.iter =
    10000,
  
  n.burnin =
    2000,
  
  n.thin =
    2,
  
  bugs.directory =
    bugs.directory,
  
  working.directory =
    working.directory,
  
  DIC =
    TRUE,
  
  codaPkg =
    FALSE,
  
  debug =
    FALSE,
  
  clearWD =
    FALSE
)


# =============================================================================
# 28. PRINT SURVIVAL RESULTS
# =============================================================================


cat(
  "SURVIVAL MODEL RESULTS\n"
)
## SURVIVAL MODEL RESULTS
print(
  fit.surv,
  digits = 4
)
## Inference for Bugs model at "D:/Joint_model/winBUGS/Table3_Separate_Survival.txt", fit using WinBUGS,
##  3 chains, each with 10000 iterations (first 2000 discarded), n.thin = 2
##  n.sims = 12000 iterations saved
##               mean     sd      2.5%       25%       50%       75%     97.5%
## beta2[1]   -3.7216 0.1600   -4.0440   -3.8280   -3.7170   -3.6118   -3.4190
## beta2[2]    0.2100 0.1468   -0.0764    0.1103    0.2103    0.3074    0.4989
## beta2[3]   -0.1620 0.1226   -0.3893   -0.2458   -0.1648   -0.0812    0.0860
## beta2[4]    0.6206 0.1142    0.4039    0.5426    0.6184    0.6952    0.8525
## beta2[5]    0.0866 0.0824   -0.0755    0.0315    0.0863    0.1415    0.2508
## deviance 1617.6244 3.1589 1613.0000 1615.0000 1617.0000 1619.0000 1625.0000
##            Rhat n.eff
## beta2[1] 1.0019  2000
## beta2[2] 1.0019  2000
## beta2[3] 1.0019  1900
## beta2[4] 1.0011  9500
## beta2[5] 1.0019  2000
## deviance 1.0012  6400
## 
## For each parameter, n.eff is a crude measure of effective sample size,
## and Rhat is the potential scale reduction factor (at convergence, Rhat=1).
## 
## DIC info (using the rule, pD = Dbar-Dhat)
## pD = 5.0 and DIC = 1622.6
## DIC is an estimate of expected predictive error (lower deviance is better).
# =============================================================================
# 29. EXTRACT SURVIVAL RESULTS
# =============================================================================

surv.names <-
  paste0(
    "beta2[",
    1:5,
    "]"
  )


surv.results <-
  fit.surv$summary[
    surv.names,
    ,
    drop = FALSE
  ]


print(
  surv.results,
  digits = 4
)
##              mean      sd     2.5%      25%      50%     75%    97.5%  Rhat
## beta2[1] -3.72158 0.16004 -4.04400 -3.82800 -3.71700 -3.6118 -3.41898 1.002
## beta2[2]  0.20997 0.14677 -0.07637  0.11027  0.21030  0.3074  0.49890 1.002
## beta2[3] -0.16204 0.12263 -0.38930 -0.24580 -0.16485 -0.0812  0.08595 1.002
## beta2[4]  0.62057 0.11421  0.40390  0.54260  0.61840  0.6952  0.85250 1.001
## beta2[5]  0.08658 0.08243 -0.07552  0.03152  0.08629  0.1415  0.25080 1.002
##          n.eff
## beta2[1]  2000
## beta2[2]  2000
## beta2[3]  1900
## beta2[4]  9500
## beta2[5]  2000
# =============================================================================
# 30. SAVE SURVIVAL MODEL
# =============================================================================

saveRDS(
  
  fit.surv,
  
  file.path(
    working.directory,
    "Table3_Separate_Survival_fit.rds"
  )
)


# =============================================================================
# 31. CREATE LONGITUDINAL TABLE
# =============================================================================

long.parameter.names <- c(
  
  "Intercept beta11",
  
  "Time beta12",
  
  "Time x Drug beta13",
  
  "Gender beta14",
  
  "PrevOI beta15",
  
  "AZT stratum beta16",
  
  "Random intercept variance",
  
  "Random slope variance",
  
  "Random intercept-slope covariance",
  
  "Random intercept-slope correlation",
  
  "Residual variance"
)


table.long <- data.frame(
  
  Parameter =
    long.parameter.names,
  
  Mean =
    long.results[, "mean"],
  
  SD =
    long.results[, "sd"],
  
  Lower95 =
    long.results[, "2.5%"],
  
  Median =
    long.results[, "50%"],
  
  Upper95 =
    long.results[, "97.5%"],
  
  Rhat =
    long.results[, "Rhat"],
  
  Neff =
    long.results[, "n.eff"],
  
  row.names = NULL
)


cat(
  "TABLE 3 SEPARATE ANALYSIS: LONGITUDINAL\n"
)
## TABLE 3 SEPARATE ANALYSIS: LONGITUDINAL
print(
  table.long,
  digits = 4,
  row.names = FALSE
)
##                           Parameter     Mean      SD  Lower95   Median
##                    Intercept beta11  8.05161 0.34218  7.35197  8.05600
##                         Time beta12 -0.19548 0.04895 -0.29371 -0.19460
##                  Time x Drug beta13  0.05057 0.07058 -0.08457  0.04906
##                       Gender beta14 -0.15664 0.31918 -0.78282 -0.15600
##                       PrevOI beta15 -2.33440 0.23241 -2.78700 -2.33500
##                  AZT stratum beta16 -0.09343 0.23428 -0.54790 -0.09182
##           Random intercept variance 15.57279 1.12557 13.53000 15.51000
##               Random slope variance  0.39141 0.03033  0.33560  0.39020
##   Random intercept-slope covariance -0.27513 0.13821 -0.54821 -0.27250
##  Random intercept-slope correlation -0.11103 0.05425 -0.21420 -0.11130
##                   Residual variance  2.89412 0.16067  2.59300  2.88900
##    Upper95  Rhat  Neff
##   8.722050 1.002  1200
##  -0.099179 1.015   150
##   0.190700 1.008   290
##   0.477300 1.005   530
##  -1.869975 1.001  6600
##   0.370602 1.008   280
##  17.950250 1.001 12000
##   0.455000 1.001  9700
##  -0.010379 1.001  5200
##  -0.004153 1.001  5800
##   3.224000 1.001  5200
# =============================================================================
# 32. CREATE SURVIVAL TABLE
# =============================================================================

surv.parameter.names <- c(
  
  "Survival intercept beta21",
  
  "Drug beta22",
  
  "Gender beta23",
  
  "PrevOI beta24",
  
  "AZT stratum beta25"
)


table.surv <- data.frame(
  
  Parameter =
    surv.parameter.names,
  
  Mean =
    surv.results[, "mean"],
  
  SD =
    surv.results[, "sd"],
  
  Lower95 =
    surv.results[, "2.5%"],
  
  Median =
    surv.results[, "50%"],
  
  Upper95 =
    surv.results[, "97.5%"],
  
  Rhat =
    surv.results[, "Rhat"],
  
  Neff =
    surv.results[, "n.eff"],
  
  row.names = NULL
)


cat(
  "TABLE 3 SEPARATE ANALYSIS: SURVIVAL\n"
)
## TABLE 3 SEPARATE ANALYSIS: SURVIVAL
print(
  table.surv,
  digits = 4,
  row.names = FALSE
)
##                  Parameter     Mean      SD  Lower95   Median  Upper95  Rhat
##  Survival intercept beta21 -3.72158 0.16004 -4.04400 -3.71700 -3.41898 1.002
##                Drug beta22  0.20997 0.14677 -0.07637  0.21030  0.49890 1.002
##              Gender beta23 -0.16204 0.12263 -0.38930 -0.16485  0.08595 1.002
##              PrevOI beta24  0.62057 0.11421  0.40390  0.61840  0.85250 1.001
##         AZT stratum beta25  0.08658 0.08243 -0.07552  0.08629  0.25080 1.002
##  Neff
##  2000
##  2000
##  1900
##  9500
##  2000
# =============================================================================
# 33. COMBINE BOTH TABLES
# =============================================================================

table3.separate <- rbind(
  
  transform(
    table.long,
    Model = "Longitudinal"
  ),
  
  transform(
    table.surv,
    Model = "Survival"
  )
)


# Put Model first

table3.separate <-
  table3.separate[
    c(
      "Model",
      "Parameter",
      "Mean",
      "SD",
      "Lower95",
      "Median",
      "Upper95",
      "Rhat",
      "Neff"
    )
  ]



cat(
  "GUO-CARLIN TABLE 3: COMPLETE SEPARATE ANALYSIS\n"
)
## GUO-CARLIN TABLE 3: COMPLETE SEPARATE ANALYSIS
print(
  table3.separate,
  digits = 4,
  row.names = FALSE
)
##         Model                          Parameter     Mean      SD  Lower95
##  Longitudinal                   Intercept beta11  8.05161 0.34218  7.35197
##  Longitudinal                        Time beta12 -0.19548 0.04895 -0.29371
##  Longitudinal                 Time x Drug beta13  0.05057 0.07058 -0.08457
##  Longitudinal                      Gender beta14 -0.15664 0.31918 -0.78282
##  Longitudinal                      PrevOI beta15 -2.33440 0.23241 -2.78700
##  Longitudinal                 AZT stratum beta16 -0.09343 0.23428 -0.54790
##  Longitudinal          Random intercept variance 15.57279 1.12557 13.53000
##  Longitudinal              Random slope variance  0.39141 0.03033  0.33560
##  Longitudinal  Random intercept-slope covariance -0.27513 0.13821 -0.54821
##  Longitudinal Random intercept-slope correlation -0.11103 0.05425 -0.21420
##  Longitudinal                  Residual variance  2.89412 0.16067  2.59300
##      Survival          Survival intercept beta21 -3.72158 0.16004 -4.04400
##      Survival                        Drug beta22  0.20997 0.14677 -0.07637
##      Survival                      Gender beta23 -0.16204 0.12263 -0.38930
##      Survival                      PrevOI beta24  0.62057 0.11421  0.40390
##      Survival                 AZT stratum beta25  0.08658 0.08243 -0.07552
##    Median   Upper95  Rhat  Neff
##   8.05600  8.722050 1.002  1200
##  -0.19460 -0.099179 1.015   150
##   0.04906  0.190700 1.008   290
##  -0.15600  0.477300 1.005   530
##  -2.33500 -1.869975 1.001  6600
##  -0.09182  0.370602 1.008   280
##  15.51000 17.950250 1.001 12000
##   0.39020  0.455000 1.001  9700
##  -0.27250 -0.010379 1.001  5200
##  -0.11130 -0.004153 1.001  5800
##   2.88900  3.224000 1.001  5200
##  -3.71700 -3.418975 1.002  2000
##   0.21030  0.498900 1.002  2000
##  -0.16485  0.085950 1.002  1900
##   0.61840  0.852505 1.001  9500
##   0.08629  0.250802 1.002  2000
# =============================================================================
# 34. SAVE SUMMARY TABLE
# =============================================================================

write.csv(
  
  table3.separate,
  
  file.path(
    working.directory,
    "Guo_Carlin_Table3_Separate_Results.csv"
  ),
  
  row.names = FALSE
)


# =============================================================================
# 35. SAVE EVERYTHING
# =============================================================================

save(
  
  fit.long,
  
  fit.surv,
  
  table.long,
  
  table.surv,
  
  table3.separate,
  
  file = file.path(
    working.directory,
    "Guo_Carlin_Table3_Separate_All.RData"
  )
)
############################
#### Separate Survival model with frailty 



# =============================================================================
# SEPARATE SURVIVAL MODEL WITH FRAILTY U3
# =============================================================================


# =============================================================================
# 19. PREPARE SURVIVAL DATA
# =============================================================================

event <-
  as.integer(
    aids.id$event
  )


survival.time <-
  as.numeric(
    aids.id$Time
  )


# =============================================================================
# 20. WINBUGS CENSORING FORMAT
# =============================================================================

surt <-
  ifelse(
    event == 1,
    survival.time,
    NA_real_
  )


surt.cen <-
  ifelse(
    event == 0,
    survival.time,
    0
  )


cat(
  "\n============================================\n"
)
## 
## ============================================
cat(
  "SURVIVAL DATA\n"
)
## SURVIVAL DATA
cat(
  "============================================\n"
)
## ============================================
cat(
  "Subjects  =",
  N,
  "\n"
)
## Subjects  = 467
cat(
  "Deaths    =",
  sum(event == 1),
  "\n"
)
## Deaths    = 188
cat(
  "Censored  =",
  sum(event == 0),
  "\n"
)
## Censored  = 279
cat(
  "Follow-up range =",
  range(survival.time),
  "\n\n"
)
## Follow-up range = 0.47 21.4
# =============================================================================
# 21. PRIORS FOR SURVIVAL MODEL
# =============================================================================

betamu2 <-
  rep(
    0,
    5
  )


Sigma2 <-
  diag(
    0.01,
    5
  )


# =============================================================================
# 22. SURVIVAL WINBUGS DATA
# =============================================================================

winbugs.data.surv.frailty <- list(
  
  N = N,
  
  surt = surt,
  
  surt.cen = surt.cen,
  
  randgrp1 = randgrp1,
  
  gender1 = gender1,
  
  prevoi1 = prevoi1,
  
  stratum1 = stratum1,
  
  betamu2 = betamu2,
  
  Sigma2 = Sigma2
)


# =============================================================================
# 23. SURVIVAL WINBUGS MODEL WITH FRAILTY U3
# =============================================================================
#
# Separate survival model:
#
# log(mut[i]) =
#
#     beta2[1]
#   + beta2[2] * drug
#   + beta2[3] * gender
#   + beta2[4] * prevOI
#   + beta2[5] * stratum
#   + U3[i]
#
#
# IMPORTANT:
#
# U1 and U2 are NOT included.
#
# U3 is an independent survival-specific frailty.
#
# =============================================================================

winbugs.model.surv.frailty <- "
model {

  # ---------------------------------------------------------------------------
  # SURVIVAL LIKELIHOOD
  # ---------------------------------------------------------------------------

  for (i in 1:N) {

    surt[i] ~ dweib(
      1,
      mut[i]
    ) I(surt.cen[i], )

    log(mut[i]) <-
        beta2[1]
      + beta2[2] * randgrp1[i]
      + beta2[3] * gender1[i]
      + beta2[4] * prevoi1[i]
      + beta2[5] * stratum1[i]
      + U3[i]

    # -------------------------------------------------------------------------
    # SUBJECT-SPECIFIC FRAILTY
    # -------------------------------------------------------------------------

    U3[i] ~ dnorm(
      0,
      tau3
    )

  }


  # ---------------------------------------------------------------------------
  # FIXED-EFFECT PRIOR
  # ---------------------------------------------------------------------------

  beta2[1:5] ~ dmnorm(
    betamu2[],
    Sigma2[,]
  )


  # ---------------------------------------------------------------------------
  # FRAILTY VARIANCE PRIOR
  # ---------------------------------------------------------------------------
  #
  # Precision:
  #
  #       tau3 = 1 / sigma3
  #
  # Here sigma3 is the frailty variance.
  #
  # ---------------------------------------------------------------------------

  tau3 ~ dgamma(
    0.1,
    0.1
  )


  # ---------------------------------------------------------------------------
  # DERIVED FRAILTY VARIANCE / SD
  # ---------------------------------------------------------------------------

  sigma3 <-
    1 / tau3


  sd3 <-
    sqrt(
      sigma3
    )

}
"


# =============================================================================
# 24. WRITE SURVIVAL FRAILTY MODEL FILE
# =============================================================================

model.file.surv.frailty <- file.path(
  working.directory,
  "Table3_Separate_Survival_Frailty.txt"
)


writeLines(
  winbugs.model.surv.frailty,
  model.file.surv.frailty
)


# =============================================================================
# 25. SURVIVAL FRAILTY INITIAL VALUES
# =============================================================================

surv.frailty.inits <- function(chain) {
  
  set.seed(
    3000 + chain
  )
  
  
  # Initial latent survival times for censored subjects
  
  surt.init <-
    rep(
      NA_real_,
      N
    )
  
  
  censored <-
    which(
      event == 0
    )
  
  
  surt.init[censored] <-
    survival.time[censored] +
    runif(
      length(censored),
      0.1,
      2
    )
  
  
  list(
    
    beta2 =
      c(
        -3.5,
        rnorm(
          4,
          mean = 0,
          sd = 0.1
        )
      ),
    
    
    # Initial frailties
    
    U3 =
      rnorm(
        N,
        mean = 0,
        sd = 0.05
      ),
    
    
    # Initial frailty precision
    
    tau3 =
      1,
    
    
    # Latent survival times for censored subjects
    
    surt =
      surt.init
  )
}


inits.surv.frailty <-
  lapply(
    1:n.chains,
    surv.frailty.inits
  )


# =============================================================================
# 26. PARAMETERS TO SAVE
# =============================================================================
#
# We MUST save U3 because Figure 3(b) and 3(c) require
# patient-specific frailty values for patients 450 and 454.
#
# =============================================================================

parameters.surv.frailty <- c(
  
  "beta2",
  
  "U3",
  
  "tau3",
  
  "sigma3",
  
  "sd3"
)


# =============================================================================
# 27. RUN SURVIVAL MODEL WITH FRAILTY
# =============================================================================

cat(
  "\n============================================================\n"
)
## 
## ============================================================
cat(
  "RUNNING SEPARATE SURVIVAL MODEL WITH FRAILTY U3\n"
)
## RUNNING SEPARATE SURVIVAL MODEL WITH FRAILTY U3
cat(
  "============================================================\n\n"
)
## ============================================================
fit.surv.frailty <- bugs(
  
  data =
    winbugs.data.surv.frailty,
  
  inits =
    inits.surv.frailty,
  
  parameters.to.save =
    parameters.surv.frailty,
  
  model.file =
    model.file.surv.frailty,
  
  n.chains =
    n.chains,
  
  n.iter =
    10000,
  
  n.burnin =
    2000,
  
  n.thin =
    2,
  
  bugs.directory =
    bugs.directory,
  
  working.directory =
    working.directory,
  
  DIC =
    TRUE,
  
  codaPkg =
    FALSE,
  
  debug =
    FALSE,
  
  clearWD =
    FALSE
)

R code for figure 3

aids.id2 <- aids.id %>%
  mutate(
    
    randgrp1 = ifelse(
      as.character(drug) == "ddI",
      1,
      0
    ),
    
    gender1 = ifelse(
      as.character(gender) == "male",
      1,
      -1
    ),
    
    prevoi1 = ifelse(
      as.character(prevOI) == "AIDS",
      1,
      -1
    ),
    
    stratum1 = ifelse(
      as.character(AZT) == "failure",
      1,
      -1
    ),
    
    event = as.integer(death)
  )




p450_4 <- aids %>% 
  filter(patient %in% c(450, 454)) %>%
  mutate(
    patient = factor(
      patient,
      levels = c(450, 454),
      labels = c("Patient 450", "Patient 454")
    )
  )

p3a <- ggplot(
  p450_4,
  aes(
    x = obstime,
    y = CD4,
    group = patient,
    linetype = patient
  )
) +
  geom_line(linewidth = 1) +
  geom_point(size = 2) +
  
  # Line labels
  scale_linetype_manual(
    name = NULL,
    values = c(
      "Patient 450" = "solid",
      "Patient 454" = "dashed"
    )
  ) +
  
  # Axis limits
  coord_cartesian(
    xlim = c(0, 20),
    ylim = c(0, 15)
  ) +
  
  scale_x_continuous(
    breaks = seq(0, 20, 5)
  ) +
  
  scale_y_continuous(
    breaks = seq(0, 15, 5)
  ) +
  
  labs(
    x = "Time (months)",
    y = "Square-root CD4 count"
  ) +
  
  theme_classic() +
  
  theme(
    legend.position = "top"
  )

p3a

# =============================================================================
# GUO & CARLIN (2004)
# FIGURE 3(b) AND FIGURE 3(c)
#
# Posterior density of median survival time
#
# Three analyses:
#
#   1. Joint Model XI
#   2. Separate survival model with frailty U3
#   3. Separate survival model with no frailty
#
# Common KDE bandwidth:
#
#       bw = 15
#
# Line types:
#
#       Joint analysis                 = solid
#       Separate analysis with frailty = dotted
#       Separate analysis no frailty   = dashed
#
# =============================================================================


# =============================================================================
# CREATE POSTERIOR MEDIAN SURVIVAL DRAWS FOR PATIENT 450
# =============================================================================


# -----------------------------------------------------------------------------
# 1. Find Patient 450
# -----------------------------------------------------------------------------

index.450 <- which(
  aids.id2$patient == 450
)

index.450
## [1] 450
# Check covariates
aids.id2[
  index.450,
  c(
    "patient",
    "drug",
    "gender",
    "prevOI",
    "AZT",
    "randgrp1",
    "gender1",
    "prevoi1",
    "stratum1"
  )
]
##     patient drug gender prevOI     AZT randgrp1 gender1 prevoi1 stratum1
## 450     450  ddI   male   AIDS failure        1       1       1        1
# Patient 450 should be:
#
# ddI          -> randgrp1 = 1
# male         -> gender1  = 1
# AIDS         -> prevoi1  = 1
# AZT failure  -> stratum1 = 1
#
# This is the "bad covariates / good CD4 trajectory" patient.


# =============================================================================
# 2. JOINT MODEL XI
# =============================================================================
#
# eta =
#
# beta2[1]
# + beta2[2] * drug
# + beta2[3] * gender
# + beta2[4] * prevOI
# + beta2[5] * AZT
# + r1 * U1
# + r2 * U2
#
# =============================================================================


# Convert posterior simulations to matrix
post.joint <- as.matrix(
  fit.model.xi$sims.matrix
)


# Survival regression parameters
beta2.joint <- post.joint[
  ,
  paste0(
    "beta2[",
    1:5,
    "]"
  ),
  drop = FALSE
]


# Association parameters
r1.joint <- post.joint[, "r1"]

r2.joint <- post.joint[, "r2"]


# Patient-specific longitudinal random effects
U1.450.joint <-
  post.joint[
    ,
    paste0(
      "U[",
      index.450,
      ",1]"
    )
  ]


U2.450.joint <-
  post.joint[
    ,
    paste0(
      "U[",
      index.450,
      ",2]"
    )
  ]


# Linear predictor
LP.joint.450 <-
  beta2.joint[, 1] +
  beta2.joint[, 2] *
  aids.id2$randgrp1[index.450] +
  beta2.joint[, 3] *
  aids.id2$gender1[index.450] +
  beta2.joint[, 4] *
  aids.id2$prevoi1[index.450] +
  beta2.joint[, 5] *
  aids.id2$stratum1[index.450] +
  r1.joint * U1.450.joint +
  r2.joint * U2.450.joint


# Posterior draws of median survival time
median.joint.450 <-
  log(2) /
  exp(
    LP.joint.450
  )


# =============================================================================
# 3. SEPARATE SURVIVAL MODEL WITHOUT FRAILTY
# =============================================================================


post.nofrail <- as.matrix(
  fit.surv$sims.matrix
)


beta2.nofrail <-
  post.nofrail[
    ,
    paste0(
      "beta2[",
      1:5,
      "]"
    ),
    drop = FALSE
  ]


LP.nofrail.450 <-
  beta2.nofrail[, 1] +
  beta2.nofrail[, 2] *
  aids.id2$randgrp1[index.450] +
  beta2.nofrail[, 3] *
  aids.id2$gender1[index.450] +
  beta2.nofrail[, 4] *
  aids.id2$prevoi1[index.450] +
  beta2.nofrail[, 5] *
  aids.id2$stratum1[index.450]


median.nofrail.450 <-
  log(2) /
  exp(
    LP.nofrail.450
  )


# =============================================================================
# 4. SEPARATE SURVIVAL MODEL WITH FRAILTY
# =============================================================================


post.frailty <- as.matrix(
  fit.surv.frailty$sims.matrix
)


beta2.frailty <-
  post.frailty[
    ,
    paste0(
      "beta2[",
      1:5,
      "]"
    ),
    drop = FALSE
  ]


# Subject-specific survival frailty
U3.450 <-
  post.frailty[
    ,
    paste0(
      "U3[",
      index.450,
      "]"
    )
  ]


LP.frailty.450 <-
  beta2.frailty[, 1] +
  beta2.frailty[, 2] *
  aids.id2$randgrp1[index.450] +
  beta2.frailty[, 3] *
  aids.id2$gender1[index.450] +
  beta2.frailty[, 4] *
  aids.id2$prevoi1[index.450] +
  beta2.frailty[, 5] *
  aids.id2$stratum1[index.450] +
  U3.450


median.frailty.450 <-
  log(2) /
  exp(
    LP.frailty.450
  )


# =============================================================================
# 5. CHECK THE THREE OBJECTS
# =============================================================================

summary(
  median.joint.450
)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   23.70   57.54   70.80   75.45   87.88  328.21
summary(
  median.frailty.450
)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   3.299  12.027  14.889  16.174  18.611 122.034
summary(
  median.nofrail.450
)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    8.49   12.38   13.41   13.57   14.62   21.84
quantile(
  median.joint.450,
  c(0.025, 0.5, 0.975)
)
##      2.5%       50%     97.5% 
##  39.73041  70.80116 137.48482
quantile(
  median.frailty.450,
  c(0.025, 0.5, 0.975)
)
##      2.5%       50%     97.5% 
##  8.090148 14.888693 32.515563
quantile(
  median.nofrail.450,
  c(0.025, 0.5, 0.975)
)
##     2.5%      50%    97.5% 
## 10.59291 13.41471 17.25463
# =============================================================================
# 1. POSTERIOR SUMMARY FUNCTION
# =============================================================================

survival.summary <- function(x) {
  
  c(
    
    Median =
      median(
        x
      ),
    
    Lower =
      unname(
        quantile(
          x,
          0.025
        )
      ),
    
    Upper =
      unname(
        quantile(
          x,
          0.975
        )
      )
  )
}

# =============================================================================
# PATIENT 454
# POSTERIOR MEDIAN SURVIVAL TIME
# =============================================================================


# -----------------------------------------------------------------------------
# 1. Find Patient 454
# -----------------------------------------------------------------------------

index.454 <- which(
  aids.id2$patient == 454
)

index.454
## [1] 454
# Check covariates
aids.id2[
  index.454,
  c(
    "patient",
    "drug",
    "gender",
    "prevOI",
    "AZT",
    "randgrp1",
    "gender1",
    "prevoi1",
    "stratum1"
  )
]
##     patient drug gender prevOI         AZT randgrp1 gender1 prevoi1 stratum1
## 454     454  ddI   male noAIDS intolerance        1       1      -1       -1
# Patient 454 should be:
#
# ddI             -> randgrp1 =  1
# male            -> gender1  =  1
# AIDS-negative   -> prevoi1  = -1
# AZT intolerant  -> stratum1 = -1
#
# Patient 454 therefore has relatively favourable baseline covariates,
# but an unfavourable CD4 trajectory.


# =============================================================================
# 2. JOINT MODEL XI
# =============================================================================
#
# eta =
#
# beta2[1]
# + beta2[2] * drug
# + beta2[3] * gender
# + beta2[4] * prevOI
# + beta2[5] * AZT
# + r1 * U1
# + r2 * U2
#
# =============================================================================


# Convert posterior simulations to matrix
post.joint <- as.matrix(
  fit.model.xi$sims.matrix
)


# Survival regression parameters
beta2.joint <- post.joint[
  ,
  paste0(
    "beta2[",
    1:5,
    "]"
  ),
  drop = FALSE
]


# Association parameters
r1.joint <- post.joint[, "r1"]

r2.joint <- post.joint[, "r2"]


# -----------------------------------------------------------------------------
# Patient-specific longitudinal random effects
# -----------------------------------------------------------------------------

U1.454.joint <-
  post.joint[
    ,
    paste0(
      "U[",
      index.454,
      ",1]"
    )
  ]


U2.454.joint <-
  post.joint[
    ,
    paste0(
      "U[",
      index.454,
      ",2]"
    )
  ]


# -----------------------------------------------------------------------------
# Linear predictor
# -----------------------------------------------------------------------------

LP.joint.454 <-
  beta2.joint[, 1] +
  beta2.joint[, 2] *
  aids.id2$randgrp1[index.454] +
  beta2.joint[, 3] *
  aids.id2$gender1[index.454] +
  beta2.joint[, 4] *
  aids.id2$prevoi1[index.454] +
  beta2.joint[, 5] *
  aids.id2$stratum1[index.454] +
  r1.joint * U1.454.joint +
  r2.joint * U2.454.joint


# -----------------------------------------------------------------------------
# Posterior draws of median survival time
# -----------------------------------------------------------------------------

median.joint.454 <-
  log(2) /
  exp(
    LP.joint.454
  )


# =============================================================================
# 3. SEPARATE SURVIVAL MODEL WITHOUT FRAILTY
# =============================================================================


post.nofrail <- as.matrix(
  fit.surv$sims.matrix
)


beta2.nofrail <-
  post.nofrail[
    ,
    paste0(
      "beta2[",
      1:5,
      "]"
    ),
    drop = FALSE
  ]


# -----------------------------------------------------------------------------
# Linear predictor
# -----------------------------------------------------------------------------

LP.nofrail.454 <-
  beta2.nofrail[, 1] +
  beta2.nofrail[, 2] *
  aids.id2$randgrp1[index.454] +
  beta2.nofrail[, 3] *
  aids.id2$gender1[index.454] +
  beta2.nofrail[, 4] *
  aids.id2$prevoi1[index.454] +
  beta2.nofrail[, 5] *
  aids.id2$stratum1[index.454]


# -----------------------------------------------------------------------------
# Posterior median survival draws
# -----------------------------------------------------------------------------

median.nofrail.454 <-
  log(2) /
  exp(
    LP.nofrail.454
  )


# =============================================================================
# 4. SEPARATE SURVIVAL MODEL WITH FRAILTY
# =============================================================================


post.frailty <- as.matrix(
  fit.surv.frailty$sims.matrix
)


beta2.frailty <-
  post.frailty[
    ,
    paste0(
      "beta2[",
      1:5,
      "]"
    ),
    drop = FALSE
  ]


# -----------------------------------------------------------------------------
# Subject-specific survival frailty
# -----------------------------------------------------------------------------

U3.454 <-
  post.frailty[
    ,
    paste0(
      "U3[",
      index.454,
      "]"
    )
  ]


# -----------------------------------------------------------------------------
# Linear predictor
# -----------------------------------------------------------------------------

LP.frailty.454 <-
  beta2.frailty[, 1] +
  beta2.frailty[, 2] *
  aids.id2$randgrp1[index.454] +
  beta2.frailty[, 3] *
  aids.id2$gender1[index.454] +
  beta2.frailty[, 4] *
  aids.id2$prevoi1[index.454] +
  beta2.frailty[, 5] *
  aids.id2$stratum1[index.454] +
  U3.454


# -----------------------------------------------------------------------------
# Posterior median survival draws
# -----------------------------------------------------------------------------

median.frailty.454 <-
  log(2) /
  exp(
    LP.frailty.454
  )


# =============================================================================
# 5. CHECK THE THREE OBJECTS
# =============================================================================


summary(
  median.joint.454
)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   9.179  24.286  29.174  30.418  35.191  90.318
summary(
  median.frailty.454
)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   12.24   46.42   58.98   64.84   75.88  477.51
summary(
  median.nofrail.454
)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   27.83   48.20   54.97   56.56   63.04  138.57
# =============================================================================
# 6. MEDIAN AND 95% CREDIBLE INTERVAL
# =============================================================================


quantile(
  median.joint.454,
  c(
    0.025,
    0.5,
    0.975
  )
)
##     2.5%      50%    97.5% 
## 17.10833 29.17442 50.90947
quantile(
  median.frailty.454,
  c(
    0.025,
    0.5,
    0.975
  )
)
##      2.5%       50%     97.5% 
##  28.76543  58.97855 136.70357
quantile(
  median.nofrail.454,
  c(
    0.025,
    0.5,
    0.975
  )
)
##     2.5%      50%    97.5% 
## 37.80289 54.97245 84.22504
# =============================================================================
# 2. PATIENT 450 POSTERIOR SUMMARIES
# =============================================================================

summary.450 <-
  rbind(
    
    "Joint analysis" =
      survival.summary(
        median.joint.450
      ),
    
    "Separate analysis with frailty" =
      survival.summary(
        median.frailty.450
      ),
    
    "Separate analysis with no frailty" =
      survival.summary(
        median.nofrail.450
      )
  )


cat(
  "\n============================================================\n"
)
## 
## ============================================================
cat(
  "PATIENT 450\n"
)
## PATIENT 450
cat(
  "============================================================\n"
)
## ============================================================
print(
  summary.450,
  digits = 4
)
##                                   Median Lower  Upper
## Joint analysis                     70.80 39.73 137.48
## Separate analysis with frailty     14.89  8.09  32.52
## Separate analysis with no frailty  13.41 10.59  17.25
# =============================================================================
# 3. PATIENT 454 POSTERIOR SUMMARIES
# =============================================================================

summary.454 <-
  rbind(
    
    "Joint analysis" =
      survival.summary(
        median.joint.454
      ),
    
    "Separate analysis with frailty" =
      survival.summary(
        median.frailty.454
      ),
    
    "Separate analysis with no frailty" =
      survival.summary(
        median.nofrail.454
      )
  )


cat(
  "\n============================================================\n"
)
## 
## ============================================================
cat(
  "PATIENT 454\n"
)
## PATIENT 454
cat(
  "============================================================\n"
)
## ============================================================
print(
  summary.454,
  digits = 4
)
##                                   Median Lower  Upper
## Joint analysis                     29.17 17.11  50.91
## Separate analysis with frailty     58.98 28.77 136.70
## Separate analysis with no frailty  54.97 37.80  84.23
# =============================================================================
# 4. COMMON BANDWIDTH
# =============================================================================
#
# This bandwidth gives a density smoothing close to the published
# Guo & Carlin Figure 3.
#
# =============================================================================

bw.paper <- 25


# =============================================================================
# 5. FIGURE 3(b): PATIENT 450 DENSITIES
# =============================================================================

density.joint.450 <-
  density(
    median.joint.450,
    bw = bw.paper,
    #from = 0,
    #to = 160,
    n = 1024
  )


density.frailty.450 <-
  density(
    median.frailty.450,
    bw = bw.paper,
    #from = 0,
    #to = 160,
    n = 1024
  )


density.nofrail.450 <-
  density(
    median.nofrail.450,
    bw = bw.paper,
    #from = 0,
    #to = 160,
    n = 1024
  )


# =============================================================================
# 6. FIGURE 3(c): PATIENT 454 DENSITIES
# =============================================================================

density.joint.454 <-
  density(
    median.joint.454,
    bw = bw.paper,
    #from = 0,
    #to = 160,
    n = 1024
  )


density.frailty.454 <-
  density(
    median.frailty.454,
    bw = bw.paper,
    #from = 0,
    #to = 160,
    n = 1024
  )


density.nofrail.454 <-
  density(
    median.nofrail.454,
    bw = bw.paper,
    #from = 0,
    #to = 160,
    n = 1024
  )


# =============================================================================
# 7. CHECK MAXIMUM DENSITIES
# =============================================================================

cat(
  "\n============================================================\n"
)
## 
## ============================================================
cat(
  "PATIENT 450 MAXIMUM DENSITIES\n"
)
## PATIENT 450 MAXIMUM DENSITIES
cat(
  "============================================================\n"
)
## ============================================================
cat(
  "Joint       =",
  max(density.joint.450$y),
  "\n"
)
## Joint       = 0.01185449
cat(
  "Frailty     =",
  max(density.frailty.450$y),
  "\n"
)
## Frailty     = 0.01550936
cat(
  "No frailty  =",
  max(density.nofrail.450$y),
  "\n"
)
## No frailty  = 0.01592046
cat(
  "\n============================================================\n"
)
## 
## ============================================================
cat(
  "PATIENT 454 MAXIMUM DENSITIES\n"
)
## PATIENT 454 MAXIMUM DENSITIES
cat(
  "============================================================\n"
)
## ============================================================
cat(
  "Joint       =",
  max(density.joint.454$y),
  "\n"
)
## Joint       = 0.01510755
cat(
  "Frailty     =",
  max(density.frailty.454$y),
  "\n"
)
## Frailty     = 0.01189525
cat(
  "No frailty  =",
  max(density.nofrail.454$y),
  "\n"
)
## No frailty  = 0.01448489
# =============================================================================
# 8. LEGEND LABELS — PATIENT 450
# =============================================================================

legend.joint.450 <-
  sprintf(
    "Joint analysis, median=%.1f, 95%% CI=(%.1f, %.1f)",
    summary.450[
      "Joint analysis",
      "Median"
    ],
    summary.450[
      "Joint analysis",
      "Lower"
    ],
    summary.450[
      "Joint analysis",
      "Upper"
    ]
  )


legend.frailty.450 <-
  sprintf(
    "Separate analysis with frailty, median=%.1f, 95%% CI=(%.1f, %.1f)",
    summary.450[
      "Separate analysis with frailty",
      "Median"
    ],
    summary.450[
      "Separate analysis with frailty",
      "Lower"
    ],
    summary.450[
      "Separate analysis with frailty",
      "Upper"
    ]
  )


legend.nofrail.450 <-
  sprintf(
    "Separate analysis with no frailty, median=%.1f, 95%% CI=(%.1f, %.1f)",
    summary.450[
      "Separate analysis with no frailty",
      "Median"
    ],
    summary.450[
      "Separate analysis with no frailty",
      "Lower"
    ],
    summary.450[
      "Separate analysis with no frailty",
      "Upper"
    ]
  )


# =============================================================================
# 9. LEGEND LABELS — PATIENT 454
# =============================================================================

legend.joint.454 <-
  sprintf(
    "Joint analysis, median=%.1f, 95%% CI=(%.1f, %.1f)",
    summary.454[
      "Joint analysis",
      "Median"
    ],
    summary.454[
      "Joint analysis",
      "Lower"
    ],
    summary.454[
      "Joint analysis",
      "Upper"
    ]
  )


legend.frailty.454 <-
  sprintf(
    "Separate analysis with frailty, median=%.1f, 95%% CI=(%.1f, %.1f)",
    summary.454[
      "Separate analysis with frailty",
      "Median"
    ],
    summary.454[
      "Separate analysis with frailty",
      "Lower"
    ],
    summary.454[
      "Separate analysis with frailty",
      "Upper"
    ]
  )


legend.nofrail.454 <-
  sprintf(
    "Separate analysis with no frailty, median=%.1f, 95%% CI=(%.1f, %.1f)",
    summary.454[
      "Separate analysis with no frailty",
      "Median"
    ],
    summary.454[
      "Separate analysis with no frailty",
      "Lower"
    ],
    summary.454[
      "Separate analysis with no frailty",
      "Upper"
    ]
  )


# =============================================================================
# 10. FIGURE 3(b): PATIENT 450
# =============================================================================

plot(
  
  density.joint.450,
  
  type = "l",
  
  # Joint analysis = solid
  lty = 1,
  
  lwd = 2,
  
  xlim = c(
    0,
    155
  ),
  
  ylim = c(
    0,
    0.06
  ),
  
  xlab = "",
  
  ylab =
    "Posterior density",
  
  main = "",
  
  axes = FALSE,
  
  bty = "n"
)


# -----------------------------------------------------------------------------
# Separate analysis WITH frailty = dotted
# -----------------------------------------------------------------------------

lines(
  
  density.frailty.450,
  
  lty = 3,
  
  lwd = 2
)


# -----------------------------------------------------------------------------
# Separate analysis WITHOUT frailty = dashed
# -----------------------------------------------------------------------------

lines(
  
  density.nofrail.450,
  
  lty = 2,
  
  lwd = 2
)


# -----------------------------------------------------------------------------
# X AXIS
# -----------------------------------------------------------------------------

axis(
  
  side = 1,
  
  at = c(
    0,
    50,
    100,
    150
  )
)


# -----------------------------------------------------------------------------
# Y AXIS
# -----------------------------------------------------------------------------

axis(
  
  side = 2,
  
  at = c(
    0,
    0.02,
    0.04,
    0.06
  ),
  
  labels = c(
    "0.00",
    "0.02",
    "0.04",
    "0.06"
  ),
  
  las = 1
)


# -----------------------------------------------------------------------------
# LEGEND
# -----------------------------------------------------------------------------

legend(
  
  "topright",
  
  legend =
    c(
      legend.joint.450,
      legend.frailty.450,
      legend.nofrail.450
    ),
  
  lty =
    c(
      1,
      3,
      2
    ),
  
  lwd =
    c(
      2,
      2,
      2
    ),
  
  bty = "o",
  
  cex = 0.75
)


box()


mtext(
  
  "(b) Patient 450",
  
  side = 1,
  
  line = 3,
  
  font = 2
)

# =============================================================================
# 11. FIGURE 3(c): PATIENT 454
# =============================================================================
#
# Use the SAME smoothing bandwidth as Patient 450.
#
# The x-axis is kept at 0-150 so Figures 3(b) and 3(c)
# are directly comparable.
#
# =============================================================================

plot(
  
  density.joint.454,
  
  type = "l",
  
  # Joint analysis = solid
  lty = 1,
  
  lwd = 2,
  
  xlim = c(
    0,
    155
  ),
  
  ylim = c(
    0,
    0.06
  ),
  
  xlab = "",
  
  ylab =
    "Posterior density",
  
  main = "",
  
  axes = FALSE,
  
  bty = "n"
)


# -----------------------------------------------------------------------------
# Separate analysis WITH frailty = dotted
# -----------------------------------------------------------------------------

lines(
  
  density.frailty.454,
  
  lty = 3,
  
  lwd = 2
)


# -----------------------------------------------------------------------------
# Separate analysis WITHOUT frailty = dashed
# -----------------------------------------------------------------------------

lines(
  
  density.nofrail.454,
  
  lty = 2,
  
  lwd = 2
)


# -----------------------------------------------------------------------------
# X AXIS
# -----------------------------------------------------------------------------

axis(
  
  side = 1,
  
  at = c(
    0,
    50,
    100,
    150
  )
)


# -----------------------------------------------------------------------------
# Y AXIS
# -----------------------------------------------------------------------------

axis(
  
  side = 2,
  
  at = c(
    0,
    0.02,
    0.04,
    0.06
  ),
  
  labels = c(
    "0.00",
    "0.02",
    "0.04",
    "0.06"
  ),
  
  las = 1
)


# -----------------------------------------------------------------------------
# LEGEND
# -----------------------------------------------------------------------------

legend(
  
  "topright",
  
  legend =
    c(
      legend.joint.454,
      legend.frailty.454,
      legend.nofrail.454
    ),
  
  lty =
    c(
      1,
      3,
      2
    ),
  
  lwd =
    c(
      2,
      2,
      2
    ),
  
  bty = "o",
  
  cex = 0.75
)


box()


mtext(
  
  "(c) Patient 454",
  
  side = 1,
  
  line = 3,
  
  font = 2
)

Here are the WinBUGS code for model XI and XII provided by the authors.

Download model XI code

Download model XI code

These code can be directly downloaded from the website: https://www.counterpointstat.com/software-and-peer-reviewed-literature.html