```r library(calibR)

This work was inspired by a the DARTH workgroup code (www.darthworkgroup.com). When using or modifying this code, please do so with attribution and cite our publications:

  Alarid-Escudero F, Maclehose RF, Peralta Y, Kuntz KM, Enns EA. Non-identifiability in model calibration and implications for medical decision making. Med Decis Making. 2018; 38(7):810-821.

Jalal H, Pechlivanoglou P, Krijkamp E, Alarid-Escudero F, Enns E, Hunink MG. An Overview of R in Health Decision Sciences. Med Decis Making. 2017; 37(3): 735-746.

A walkthrough of the code could be found in the follwing link:
  - https://darth-git.github.io/calibSMDM2018-materials/

  # Calibration Specifications

  ## Model:
  The model (Nicolas _et al.,_, 2017) is adapted from approaches for modelling HIV in high-burden settings. The population is divided into five health states including non-susceptible (N), susceptible (S), early disease (E), late disease (L), and treatment (T). The number of individuals by state and year (t) is given by $N_t$, $S_t$, $E_t$, $L_t$, and $T_t$ respectively. Individuals enter the model distributed across the $N$ and $S$ states, and transition between states to allow for infection ($S$ to $E$), disease progression ($E$ to $L$), treatment initiation ($E$ and $L$ to $T$), and death ($N$, $S$, $E$, $L$ and $T$ to $D$) via background and disease-specific mortality.

The diagram below represents the model.
![HIV model](images/HIV_model.JPG)

## Inputs to be calibrated:
- `mu_e` Cause-specific mortality rate with early-stage disease
- `mu_l` Cause-specific mortality rate with late-stage disease
- `mu_t` Cause-specific mortality rate on treatment
- `p` Transition rate from early to late-stage disease
- `r_l` Rate of uptake onto treatment (r_l = late-stage disease)
- `rho` Effective contact rate
- `b` Fraction of population in at-risk group

## Targets:
- `Surv` HIV survival (in years) without treatment
- `Prev` Prevalence at 10, 20, 30 years
- `Trt_vol` Treatment volume (in $000) at 30 years

# Search method:
Random search using:
  - Full factorial grid
- Random grid
- Latin-Hypercube Sampling

# Goodness-of-fit measure:
- Sum of log-likelihoods
- Sum of squared errors

# Visualise target data:

```r
# Plotting target data - survival ("Surv"):
targets_pt = ggplot(data = HID_data$l_targets$Surv,
                    aes(x = time,
                        y = value)) +
  geom_errorbar(aes(ymin = lb, ymax = ub)) +
  geom_point() +
  theme(
    panel.border = element_rect(fill = NA, color = 'black')
  ) +
  labs(title = "Calibration target",
       x = "Time",
       y = "Proportion survived")
targets_pt
targets_pt2 = ggplot(data = lst_targets$Surv,
                     aes(x = time,
                         y = value)) +
  geom_line() +
  geom_line(aes(x = time, y = lb), linetype = 'dashed', color = 'red',
            show.legend = TRUE) +
  geom_line(aes(x = time, y = ub), linetype = 'dashed', color = 'red',
            show.legend = TRUE) +
  scale_color_manual(values = c('black', 'red', 'red'),
                     breaks = c('value', 'lb', 'ub'),
                     labels = c('Survival', '95% CI', '95% CI')) +
  theme(
    panel.border = element_rect(fill = NA, color = 'black')
  ) +
  labs(title = "Calibration target",
       x = "Time",
       y = "Proportion survived")
targets_pt2


W-Mohammed/calibrater documentation built on Oct. 14, 2023, 1:57 a.m.