Hi everyone! I'm relatively new to Stata (and the forum) and am having some trouble figuring out a new statistical analysis. I am looking at male testosterone level variation in relation to age and BMI. I collected six samples from each participant (one in the morning and one in the evening for three days to capture how testosterone levels change throughout the day) and I used multilevel models to account for within-individual and between-individual variation (and calculate daily change in testosterone and total daily production). However, I ran into a problem when I added age and BMI into the models. Age and testosterone levels do not exhibit a linear relationship. Testosterone is low in young men, peaks in adulthood, and declines in older men. To account for this non-linear relationship, I used the mkspline command to calculate restricted cubic splines for each testosterone sample. For example (where "LogT_t1" is the log transformed concentration value of the first testosterone sample):
mkspline Agesp = Age, cubic displayknots nknots(3)
regress LogT_t1 Agesp*
I would now like to use these regression equations to generate an age-adjusted value for each of the six testosterone samples, which I can then plug into my multilevel models and examine the association between the age-adjusted testosterone parameters and BMI. Any recommendations for how to do this? Thank you.
mkspline Agesp = Age, cubic displayknots nknots(3)
regress LogT_t1 Agesp*
I would now like to use these regression equations to generate an age-adjusted value for each of the six testosterone samples, which I can then plug into my multilevel models and examine the association between the age-adjusted testosterone parameters and BMI. Any recommendations for how to do this? Thank you.
Comment