Skip to content

Conversation

@alyst
Copy link

@alyst alyst commented Jun 24, 2025

At the moment topFeatures() uses posterior-adjusted residual degree-of-freedom (getDfPosterior()) for the p-value calculation of fixed effects in linear mixed-effect models.
In the context of topFeatures(), the DoF that should be used when calculating the p-value is the denominator degree-of-freedom for a given effect (the nominator DoF should be 1 for most of the cases).
Using residual DoF as the approximation of the DDoF can, in some cases (many precursors in a single protein group), lead to a significant overestimation of DDoF (10x or more), and, as a result, to a large overestimation of the effect significance (p-values).
This draft PR adds support for using alternative methods for DDoF calculation:

  • adds ddf.method arg to the topFeatures() call (defaults to residual to maintain the current behavior)
  • adds support DDoF calculation methods from the parameters R package: dof_kenward(), dof_ml1(), dof_satterthwaite().
    (via alternative ddf.method values). The parameters package dependency is optional (Suggested): if the user-specified ddf.method method requires parameters package, but it is not available, topFeatures() will fail.

The PR also ensures that the row names of the topFeatures() match the names of the corresponding models (i.e. protein group IDs) after significance filtering and sorting.

It also cleans up a bit the code related to msqrobLmer() and adds support for optional storing the original lmerMod model output, as it is required for the dof_xxx() calls.

The ridge models are not yet supported (the ridge codepath modifies the original model, and I have not yet figured out how to make dof_xxx() calls work with it).

Let me know what you think.

Alexey Stukalov added 15 commits June 24, 2025 14:36
match colsMetadata order to the data columns
add ddf.method parameter to topFeatures() to support using dof_xxx()
methods from the parameters package for DDoF calculation instead of
using the residual DoF.
Calling .create.model() with undefined w causes CI failures.
For weights, .create.model() uses model@frame$`(weights)`.
@alyst
Copy link
Author

alyst commented Aug 6, 2025

@StijnVandenbulcke @cvanderaa Could you please take a look at this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant