Repeated measures with one between subject and two within subject factors

I have measured plasma cortisol levels in blood samples collected at an interval of 1 hour over a period of 24 hours in 10 male and female animals when they were 12 months of age. When these animals reached an age of 24 months, the experiment was repeated.

If I consider sex of animal as a between-subject factor, then there would be two within-subject factors (age and hour) which are in repeated measures. Please suggest a suitable analysis which considers the repeated measures in relation to hour and age along with the gender as a between subjects factor.
Hi, you can use a hierarchical regression model, with cortisol level as a continuous outcome. Here, "sex" is a categorical fixed predictor, age I would also take as a categorical predictor (since you have only two distinct age groups), and "hour" I would take as a continuous predictor. Very important is to take participant ID as a random coeffcient, to account for the repeated measures design. Here, you can either take "ID" as a random intercept (which means that you assume that the slopes of the outcome depending on "hour" are the same for all participants) or you can take "ID" as a random intercept and slope (regarding the continuous variable "hour"), if you assume that these slopes vary between different particiapants. Usually, the latter assumption is more realistic.