4
$\begingroup$

I have a data set where the response (dependent) variable measured only at a single time point. However the predictors can be both longitudinal as well as measured at a single time point. Here is an reproducible example :

dat <- data.frame(
  id=rep(1:100),
  y = rbinom(n = 100, size = 1, prob = 0.45),
  x_cat = as.factor(rbinom(n = 100, size = 1, prob = 0.2)),
  x1_w1 = rnorm(n = 100, mean = 10, sd = 7),
  x1_w2 = rnorm(n = 100, mean = 10, sd = 7),
  x2_w1 = as.factor(rbinom(n = 100, size = 1, prob = 0.4)),
  x2_w2 = as.factor(rbinom(n = 100, size = 1, prob = 0.48))

)

> head(dat)
  id y x_cat     x1_w1     x1_w2 x2_w1 x2_w2
1  1 0     0 12.592883 14.124617     1     0
2  2 1     1 10.615650 12.672418     0     0
3  3 1     0 10.597431 21.168571     0     0
4  4 1     0  4.338312  5.257146     0     0
5  5 1     0  9.671094  5.704907     0     0
6  6 1     0 19.468497  6.862050     0     0

So for each id , there is a binary response y , a categorical predictor x_cat which measured only at a single time point.

Also x1 is a longitudinal (time varying) continuous predictor which measured at two time points (x1_w1 , x1_w2) and x2 is a longitudinal (time varying) categorical predictor which measured at two time points (x2_w1 , x2_w2).

Basically I need to create a prediction model to predict y based on the predictors.Since there are longitudinal predictors , the standard logistic regression using glm may not be suitable . Because longitudinal predictors and correlated with each other.

So based on the resources I followed , I think that the most suitable alternative is the mixed model approach. May be using glmer or lmer functions in lme4 package.

I referred this example which is quite relevant to my situation. it is recommended in there too: https://www.researchgate.net/post/How_to_estimate_time_dependent_covariates_effects_in_logistic_regression

There are lot of examples of how to use this lme4 package when the response variable is also longitudinal.But i couldn't find any suitable tutorial/example when the response is measured at only one time point like in my situation.

So can any one help me to figure out how to apply lme4 or (any suitable package) to my situation ?

Any help would be highly appreciated.

Thank you

$\endgroup$
3
  • $\begingroup$ In your application, will the times of measurements of the time-varying predictor be the same for all cases, as in the example you provide, or are those time-varying predictors measured at different times in each case? $\endgroup$
    – EdM
    Commented Apr 4, 2020 at 15:50
  • $\begingroup$ @EdM Yeah. This is based on a study which measured at two time points. so all the cases (subjects) have the data for time varying variables at each time. But there can be missing values $\endgroup$ Commented Apr 4, 2020 at 16:11
  • $\begingroup$ @EdM is it possible to suggest anything ? Thank you $\endgroup$ Commented Apr 4, 2020 at 16:12

1 Answer 1

3
$\begingroup$

With 2 potentially time-varying predictors measured at the same 2 time points for all cases (except for some missing values*) but only one time point for determining outcome, you don't have a serious problem. The trick will be in using your knowledge of the subject matter to come up with the best way to incorporate those values into the model.

Yes, the 2 values of a predictor at different time points are likely to be correlated, but correlated predictors occur all the time in practice in regression. Those don't pose the same problems as the multiple correlated outcomes that must be dealt with in repeated measures designs or time-series analysis.

One danger in just including the 2 measurements as separate fixed effects, however, is what can happen with multicollinearity among predictors: sometimes neither of a pair of highly correlated predictors is found to be "significant" due to high variance in the individual regression coefficient estimates, even though they are truly associated with outcome. So you are wise to think about ways to deal with that.

How best to include those 2 values of the 2 predictors into the model thus depends on your understanding of the subject matter. Do you think that the outcome will depend primarily on the value measured closest to the outcome time, on their average (for the continuous predictor), or maybe on their rate of change (or difference for the categorical predictor)? Your answer to that question will point the way.

I've bounced back and forth in thinking about whether a mixed-effects model would be helpful here. As I type this I'm leaning against it. The choice of mixed-effects model would also depend on whether nearest-in-time, averages, or differences of predictor values are what matters to outcome, and without multiple correlated outcomes I don't see much to be gained from a mixed model in this case.


*See questions tagged data-imputation for ways to deal with missing values. Multiple imputation is probably the most reliable in general, but simpler methods might work for you.

$\endgroup$
3
  • $\begingroup$ Thank you for the answer. I came up to the conclusion that mixed effects model is appropriate, based on this paper: ncbi.nlm.nih.gov/pmc/articles/PMC4417225 $\endgroup$ Commented Apr 4, 2020 at 18:10
  • $\begingroup$ In this paper they have discussed a two stage model. But they mentioned that it will not be suitable when the predictors are categorical. $\endgroup$ Commented Apr 4, 2020 at 18:12
  • 1
    $\begingroup$ @student_R123 the paper dealt with up to 4 measurements over time, so a first-stage modeling of phthalate values over time was needed to get slopes and intercepts to test, in the second-stage model, whether changes over time were associated with outcome. With only 2 measurements you can go directly to a single model incorporating the continuous predictor, say, as (1) its mean value and (2) its difference. For the binary categorical (say, T/F), try a single 4-level categorical: both T, both F, T->F, F->T. Not sure that a random-effect model, with its added assumptions, would help more. $\endgroup$
    – EdM
    Commented Apr 4, 2020 at 18:49

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.