← Latest papers
📊 statistics

Extending the saemix package for R to fit non Gaussian outcomes

This paper presents an extension of the open-source R package saemix to fit non-Gaussian non-linear mixed-effect models, demonstrating its flexibility and accuracy through diverse real-world applications and a simulation study on repeated binary data.

Original authors: Emmanuelle Comets, Maud Delattre, Belhal Karimi

Published 2026-10-14
📖 7 min read🧠 Deep dive

Original authors: Emmanuelle Comets, Maud Delattre, Belhal Karimi

Original paper licensed under CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). ✨ This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

In the world of clinical research, scientists often track how people change over time. They might measure the level of a hormone in the blood, count how many times a patient feels pain, or record whether a specific event, like a hospital visit, has happened. These measurements are not just single snapshots; they are a story unfolding across days, weeks, or years. To make sense of this story, researchers use a statistical approach called non-linear mixed-effect models. Think of this as a way to draw a single, smooth curve that represents the average journey of a whole group, while also acknowledging that every individual takes a slightly different path. Some people recover faster, some slower, and some experience side effects that others do not. The challenge arises when the data being tracked does not follow a simple, bell-shaped pattern. While many biological measurements fit this smooth curve, others do not. Counts of events, yes-or-no answers, or times until an event occurs create jagged, irregular data that traditional tools struggle to interpret.

For years, researchers had powerful software to handle the smooth, bell-shaped data, but the tools for the irregular, jagged data were either expensive, closed off to the public, or difficult to use. A team of researchers led by Emmanuelle Comets, Maud Delattre, and Belhal Karimi set out to change this by expanding the capabilities of a free, open-source software package called saemix. Originally designed for continuous measurements, this tool has now been upgraded to handle the messy, real-world data that comes in the form of counts, categories, and survival times. The researchers did not just build the tool; they tested it rigorously against complex scenarios to ensure it could find the true answers hidden within the noise. Their work provides a new, accessible way for scientists to model everything from the spread of infections to the frequency of alcohol-related problems, ensuring that the unique patterns of individual patients are not lost in the search for a general average.

The core of this work lies in the algorithm the software uses, known as the SAEM algorithm. Imagine trying to find the highest point in a vast, foggy mountain range. You cannot see the whole landscape at once, and the ground is uneven. The SAEM algorithm is a method for exploring this terrain step by step. It starts with a guess, simulates possible paths through the fog, and then refines its guess based on what it learns from those simulations. It repeats this process, getting closer and closer to the true peak, which represents the most accurate description of the data. The researchers extended this method so that it could navigate the jagged peaks and valleys of non-Gaussian data—data that does not follow a standard bell curve. This includes binary data, where the outcome is simply yes or no, such as whether a toenail infection is present or absent. It also covers count data, like the number of times a patient reports a specific symptom, and time-to-event data, which tracks how long it takes for something to happen, like a recurrence of a disease.

To prove their extension worked, the team applied the updated software to real-world datasets. One example involved a clinical trial comparing two treatments for fungal toenail infections. In this study, 294 patients were monitored over nearly a year, with their infection status checked at seven different visits. The outcome was binary: either the nail was clear or it was not. The researchers used saemix to model how the infection cleared over time and whether one treatment worked better than the other. They found that the software could accurately estimate the rate at which the infection resolved and the effect of the treatment, matching results from previous studies that used different, more expensive software. This was a significant validation, showing that the open-source tool could handle the complexity of medical trials where patients respond differently to the same therapy.

Another test case involved a study on alcohol-related problems among college students. This dataset contained thousands of repeated measurements of how many problems students reported every six months. The data was tricky because a large number of students reported zero problems at many points, creating a massive spike at the bottom of the chart, while others reported varying numbers of issues. Standard models often fail with such data because they cannot easily distinguish between people who never have problems and those who have them occasionally. The researchers used saemix to fit three different types of models to this count data. They found that models specifically designed to handle the excess zeros, such as the zero-inflated Poisson model, provided a much better fit than a standard model. The software successfully captured the fact that the number of problems decreased over time and that men tended to report slightly more issues than women, all while accounting for the unique variability between individual students.

To be absolutely sure the software was reliable, the team did not stop at real-world examples. They created a simulation study, essentially generating thousands of fake datasets where they knew the exact answers beforehand. They fed these known scenarios into saemix to see if the software could recover the true values. In the case of binary data, the software performed exceptionally well, recovering the true parameters with very little error. Even when they introduced more complexity by allowing individual variability in the rate of change, the software remained stable. The researchers also tested different starting points for the calculations to ensure the results were not just a lucky guess based on where the algorithm began. The consistency of the results across these simulations gave them confidence that the tool is robust and ready for use by other scientists.

The paper also addresses a practical limitation in how uncertainty is measured. In statistics, knowing the answer is not enough; researchers need to know how confident they can be in that answer. For standard data, this is usually calculated with a formula that works well. However, for the irregular data types this paper focuses on, that standard formula often gives misleading results. The researchers found that a different approach, called bootstrapping, worked much better. This method involves resampling the data many times to see how much the results vary. They demonstrated that using this resampling technique in saemix provided a more accurate picture of the uncertainty, ensuring that when a researcher says a treatment effect is significant, that claim is backed by solid evidence.

Throughout their work, the authors emphasized flexibility. The updated saemix package allows users to define their own likelihood functions, which is the mathematical rule that describes how likely a specific set of data is to occur. This means that if a researcher encounters a new type of data or a unique biological process, they are not locked into a pre-set model. They can write the rules for their specific situation, and the software will handle the heavy lifting of the calculations. This flexibility is a major advantage over commercial software, which often restricts users to a fixed set of models. The team also improved the visual tools within the package, allowing researchers to create clear graphs that show how well the model fits the data, helping them spot any weaknesses or areas for improvement.

The implications of this work extend beyond just the code. By making these advanced modeling techniques freely available and easy to use, the researchers are lowering the barrier for scientists who want to analyze complex longitudinal data. Whether it is tracking the progression of a chronic disease, evaluating the effectiveness of a public health intervention, or understanding the dynamics of a biological system, the ability to accurately model non-standard data is crucial. The paper concludes that saemix is now a powerful, fully open-source tool capable of handling a wide variety of data types. While there are still some limitations, such as the difficulty of handling complex differential equations within the software, the extension marks a significant step forward. It offers a reliable, transparent, and flexible alternative for the scientific community, ensuring that the stories hidden in irregular data can finally be told with clarity and precision.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →