I am working on analyzing the results of an observational study, a brief description of which is as follows:
X number of diabetic subjects have been recruited to collect naturalistic driving data, and subsequently model their driving behavior as a function of a bunch of predictors such as blood-glucose level, roadway and environmental characteristics, etc.
One aspect of this study that I am currently dealing with involves modeling the driver behavior at stop-controlled intersections using the following response and predictor variables:
- Response variable: unsafe behavior (rolling stop or no stop) & safe behavior (full stop; reference level)
- Predictor variable: Cumulative exposure to glucose episodes prior to the trip start. An episode is simply an event where the blood-glucose level stays below or above a certain threshold for a certain period of time. A trip is the movement of a car between two points from engine start to stop.
So, each row in my analysis data has a value of the response (unsafe or safe), and cumulative total duration of exposure to glucose episode at the trip start. During a trip a subject can come across multiple stop intersections, so there will be multiple rows for the response but the cumulative exposure information for those responses will be the same. I am using the lme4
R package and setting up the model formula as follows:
lme4::glmer(
stop_beh ~ cumexp_episode_totalmins + (1|subj), # by-subj random effects
data = my_data,
family = "binomial"
)
I am wondering if this is the correct way to handle cumulative exposure variables in MELR models?
Update
Based on Erik's response, I thought adding how my data is organized will add clarity to my question.
"subj", "trip_id", "stop_encounter_id", "cumexp_episode_toatlmins",
# start of the study period;
# multiple stop sign encounters within a trip
"A", 1, 1, 0,
"A", 1, 2, 0,
"A", 1, 3, 0,
# driver had 15 minutes of episode before the start of trip 2;
# notice the episode info is repeated for the trip
"A", 2, 1, 15,
"A", 2, 2, 15,
"A", 2, 3, 15,
# no additional episode b/w trips 2 & 3
"A", 3, 1, 15,
"A", 3, 2, 15,
# 15 more minutes of episode between trip 3 & 4
"A", 4, 1, 30,
"A", 4, 2, 30