Comput Methods Programs Biomed. 2025 Nov 14;274:109167. doi: 10.1016/j.cmpb.2025.109167. Online ahead of print.
ABSTRACT
BACKGROUND AND OBJECTIVE: Cosinor analysis allows for the fitting of a cosine curve to describe cyclical variation in periodic data. The analysis provides an intuitive set of estimates that includes the MESOR (Midline Estimating Statistic of Rhythm), i.e., the mid-point of the fitted outcome, the amplitude, i.e., one-half the distance between the MESOR and the peak for normally distributed outcomes, and the acrophase, i.e. the time at which the outcome reaches its peak. Traditionally, most published cosinor analyses were generated though a two-stage approach in which a curve was fit to each individual’s data and differences in the estimated cosinor parameters were compared in downstream analyses. More recently multilevel cosinor modeling software has been developed which allows for the simultaneous modeling of data from multiple individuals. In addition to simplifying the model building process, the advantage of multilevel vs. two-stage cosinor analysis includes the option to fit more complex models and, likely, an improvement in fit for each individual’s data. However, to our knowledge, there are no SAS procedures or macros that assist users with this analytical approach.
METHODS: In this paper we introduce multilevel cosinor models and SAS macros we have developed to perform these analyses. In addition, we compare model fit between the multilevel and two-stage methods.
RESULTS: The SAS macros presented in this paper allow users to select the best random variable specification for the unconditional cosinor model and add a dichotomous grouping variable to detect differences in parameters across groups. At each step of model building, parameter estimates, measures of model fit and graphical output help the user understand the model derived and its appropriateness for their data. Results of cross-validation analyses are presented that illustrate the superior fit of the multilevel over the single-level approach for the dataset utilized in the examples.
CONCLUSIONS: Multilevel cosinor analysis extends the single subject cosinor model by allowing for more convenient model selection and may provide a better fit for each individual’s data. We are hopeful that this manuscript will introduce more researchers to this analytical technique and allow them to apply it in their own research.
PMID:41297072 | DOI:10.1016/j.cmpb.2025.109167