Advice on a model with 4 timepoints and 58 individuals

Hello! I’m looking for some advice on analysing this data. I think I need a multilevel model.

I have 58 participants measured progesterone and a factor at 4 timepoints. I would like to do a model to see how progesterone predicts factor1, but it should take into account repeated measurements per individual (4* per person).
factor1~progesterone

I also know that between time 1-3, progesterone will increase, and at time 4 progesterone will drop, for all.
I was thinking of a model like

mod<-lmer(Factor1 ~ timepoint + progesterone + (1 | ID ) ,data = df) which takes into account ID, but would really love some advice.

Here is similar data to what I am using:

set.seed(123)

# Number of participants and timepoints
num_part <- 58
num_timepoints <- 4

# Generate progesterone data
progesterone <- rnorm(num_part * num_timepoints, mean = 0, sd = 1)
progesterone[is.na(progesterone)] <- -3.8  # Replace NA with the specified value

# Ensure that the generated progesterone values fall within the desired range
progesterone <- pmin(pmax(progesterone, -3.8), 1.4)

# Generate Factor1 data
factor1 <- rnorm(num_part * num_timepoints, mean = 0.03, sd = 1)
factor1 <- pmin(pmax(factor1, -1.840773), 2.149765)  # Ensure values are within the desired range

# Create a data frame
df <- data.frame(
  ID = rep(1:num_part, each = num_timepoints),
  timepoint = rep(1:num_timepoints, times = num_part),
  progesterone = progesterone,
  Factor1 = factor1
)

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.