To assess the correctness of mmrm(), you can compare its results against established software like SAS's PROC MIXED. When using the sasr R package to facilitate this comparison, you must be careful with the repeated measures variable (e.g., time).
If the repeated measures variable is a factor, its alphanumeric ordering must match the expected temporal ordering. Because sasr converts R data.frame objects into pandas DataFrames (via SASPy) before transforming them into SAS datasets, factor levels like c("1", "2", ..., "10") may be reordered as "1", "10", "2", ..., "9" in SAS due to string sorting.
To avoid incorrect parameter estimation (such as swapped variances), you should:
- Use explicit factor levels for the time variable.
- Pad zeroes in the time variable (e.g.,
"01", "02"...). - Or, pass the time variable as a numeric type to avoid string-based reordering entirely.