3
$\begingroup$

Good morning, i am looking for some help with longitudinal data with time-varying binary exposure in linear mixed model. Outcome is continuous variable. I am going to use R and the lme4 package. I want to identify association between time varying smoking status and hemoglobin A1c with random intercept and random slope.

Here is a sample dataset and R code that i conducted. Is this right analysis for my hypothesis?

id smoking HbA1c visit
1 0 6.5 1
1 0 6.7 2
1 0 6.8 3
1 1 7 4
1 1 7.5 5
2 1 6.8 1
2 1 7.4 2
2 1 7.6 3
2 1 7.5 4
3 0 6.4 1
3 0 6.5 2
3 0 6.6 3
4 0 6.7 1
4 0 6.6 2
4 0 6.7 3
4 0 6.8 4
4 0 6.8 5
5 0 7 1
5 0 7 2
5 1 7 3
6 0 7.1 1
6 0 7 2
6 0 7.1 3
6 0 7.2 4
data1 <- read.xlsx("lmm_test.xlsx")
model1 <- lmer(a1c ~ smk + smk * visit + (visit | id), data = data1)
a <- tidy(model, conf.int = TRUE)
a %>% select(term, estimate, conf.low, conf.high)

# A tibble: 8 x 4
term                   estimate conf.low conf.high
smk                     -0.779   -1.22     -0.336
visit                    0.0373  -0.0218    0.0964
smk:visit                0.268    0.160     0.377 

When the results of the analysis are as above mentioned, can i interpret that glycated hemoglobin increases by 0.268 in the presence of smoking status over time (1 visit unit) than in the absence of smoking?

$\endgroup$

1 Answer 1

3
$\begingroup$

The model you have fitted has the following mathematical form: $$\texttt{HbA1c}_i(t) = \beta_0 + \beta_1 \texttt{smoking}_i(t) + \beta_2 t + \beta_3 \{\texttt{smoking}_i(t) \times t\} + b_{i0} + b_{i1} t + \varepsilon_i(t),$$ where $b_i = (b_{i0}, b_{i1})$ are the random effects.

The presence of the interaction terms complicates the interpretation. If, at a particular time point $t$, the smoking status changes from zero to one, then the HbA1c at $t$ is expected to change by $\beta_1 + \beta_3 t$.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.