The following example analyses are intended to demonstrate two potential applications of the tramME package and showcase its most important features. They are by no means complete analyses. For further examples and complete references, see the package vignette.
Bounded continuous outcomes
The neck_pain
dataset of the ordinalCont package consists of observations from a randomized, placebo-controlled trial of low-level laser therapy for chronic neck pain (reported in Chow et al., 2006; see also?ordinalCont::neck_pain
). The variables in the dataset:
id
: patient ID number (90 patients)
vas
: Perceived level of neck pain recorded by the patients on a visual analog scale. (continuous, normalized to (0, 1))
laser
: Treatment indicator for laser therapy (1: active, 2: placebo)
time
: Measurement time (1: baseline, 2: after 7 weeks, 3: after 12 weeks)
The outcome is bounded and the conditional normality assumption of a normal linear mixed model is not likely to hold. For this reason, we estimate the effect of the laser treatment over time by specifying the following continuous outcome logistic regression model: \[\begin{align*}
{\mathbb{P}}\left(\tt{pain} \leq y \mid \tt{laser}, \tt{time}, \alpha_{i}\right)
&= \text{expit}\left(h(y) + \beta_{\text{Active}} + \beta_{\text{7w}} +
\beta_{\text{12w}} + \beta_{\text{7w,Active}} +
\beta_{\text{12w, Active}} + \alpha_{i} \right)
\qquad \alpha_{i} \sim {\mathcal{N}}(0,\tau^{2}),
\end{align*}\] i.e. \(F()\) is set to the ‘expit’ function, \(h()\) is approximated with a flexible smooth function.
neck_tr <- ColrME(vas ~ laser * time + (1 | id), data = neck_pain, order = 8,
bounds = c(0, 1), support = c(0, 1))
We explicitly set the boundaries of the outcome with bounds
and support
. With order=8
, we specify the order of polynomials in Bernstein form used to approximate the baseline transformation.
summary(neck_tr)
##
## Mixed-effects Continuous Outcome Logistic Regression Model
##
## Formula: vas ~ laser * time + (1 | id)
##
## Fitted to dataset neck_pain
##
## Fixed effects parameters:
## =========================
##
## Estimate Std. Error z value Pr(>|z|)
## laser1 -2.34330 0.70339 -3.3314 0.000864 ***
## time2 -0.65379 0.37832 -1.7282 0.083959 .
## time3 -0.20559 0.36957 -0.5563 0.578020
## laser1:time2 4.94961 0.62640 7.9016 2.753e-15 ***
## laser1:time3 3.75360 0.57691 6.5064 7.695e-11 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Random effects:
## ===============
##
## Grouping factor: id (90 levels)
## Standard deviation:
## (Intercept)
## 2.7206
##
##
## Log-likelihood: 86.36643 (df = 15)
The estimated coefficients of this model are interpreted on the log-odds scale. The results indicate some evidence for baseline imbalance and significant treatment benefits at follow-up (lase1:time2
and laser1:time3
interaction terms).
To compare the marginal distributions of the treatment and control groups, we have to average over the distribution of the random effects. The results below are obtained with the predict
method of tramME and the adaptive quadrature method implemented by stats::integrate
. For comparison with the fitted (marginal) distribution functions in the various groups, we also plot the empirical cumulative distribution functions (shown by the step functions).
Time-to-event outcomes
Because the mixed-effects transformation model framework is able to accommodate non-normal data, and (randomly) censored outcomes are allowed in tramME, we can use the package to analyze grouped time-to-event outcomes.
As an example, we will use the eortc
dataset of the coxme package, which contains simulated data that replicates the structure of the outcome of a breast cancer trial by European Organization for Research and Treatment of Cancer (see ?coxme::eortc
for full details and reference). The variables in the dataset:
y
: survival time
uncens
: censoring status (0: right censored, 1: dead)
center
: enrolling center (37 centers)
trt
: treatment arm (0: control, 1: treatment)
We fit a fully parametric version of the Cox proportional hazards model with random intercepts for the centers, and center-level variability in treatment effects. \[\begin{align*}
{\mathbb{P}}\left(Y\leq y\mid \tt{trt}, a_{i}, b_{i}\right) &= 1
- \exp\left[-\exp\left\{h(y) + a_{i} + (\beta_{\tt{trt}} + b_{i})\tt{trt} \right\}\right]
\qquad
a_{i} \sim {\mathcal{N}}(0, \tau_{1}^{2}),
\quad b_{i} \sim {\mathcal{N}}(0, \tau_{2}^{2}),
\end{align*}\] with \(\tt{trt}\) as the treatment indicator. In this specification, the inverse link function is set to the CDF of the minimum extreme value distribution, and the baseline transformation function, which is now the log-cumulative baseline hazard, is approximated with polynomials in the Bernstein form.
data("eortc", package = "coxme")
eortc$trt <- factor(eortc$trt, levels = c(0, 1))
eortc_cp <- CoxphME(Surv(y, uncens) ~ trt + (1 | center/trt), data = eortc, log_first = TRUE, order = 10)
The treatment effect is interpreted in this model on the log-hazard scale.
summary(eortc_cp)
##
## Mixed-effects Parametric Cox Regression Model
##
## Formula: Surv(y, uncens) ~ trt + (1 | center/trt)
##
## Fitted to dataset eortc
##
## Fixed effects parameters:
## =========================
##
## Estimate Std. Error z value Pr(>|z|)
## trt1 0.753458 0.085189 8.8446 < 2.2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Random effects:
## ===============
##
## Grouping factor: trt:center (74 levels)
## Standard deviation:
## (Intercept)
## 0.20843
##
## Grouping factor: center (37 levels)
## Standard deviation:
## (Intercept)
## 0.25431
##
##
## Log-likelihood: -13027.2 (df = 14)
The 95% confidence interval of the hazard ratio of the treatment and control groups is
exp(confint(eortc_cp, parm = "trt1", estimate = TRUE))
## lwr upr est
## trt1 1.79767 2.510357 2.124334
To check the plausibility of the proportional hazards assumption of the treatment effects, we estimate a stratified model, where the treatment effect is allowed to change over time.
eortc_cp2 <- CoxphME(Surv(y, uncens) | trt ~ 1 + (1 | center/trt), data = eortc, log_first = TRUE, order = 10)
The separate cumulative hazard functions of the treatment and control groups are parallel, which indicates that the treatment effect is constant over time.