adamsardar / metaDEGth

metaDEGth: meta-analysis of Differentially Expressed Genes using parametric, empirically-derived P-value distributions
Mozilla Public License 2.0
0 stars 1 forks source link

Bug in plot method #36

Open adamsardar opened 1 year ago

adamsardar commented 1 year ago

What

The qqplot of observed p-values against their expected quantiles is incorrect

Why

If we prepare a simulated dataset with known alpha and lambda:

> devtools:: load_all()
> simPvals = rbetauniform(1E4, a = 0.126, lambda = 0.391)
> betaUniformModel = fitBetaUniformMixtureDistribution(simPvals)
> betaUniformModel

Beta-Uniform-Mixture (BUM) model

10000 pvalues fitted

Mixture parameter (lambda): 0.398
Beta shape parameter (a):   0.126
Negative log-likelihood:    -26465.6

> betaUnifPlots = plot(betaUniformModel)
> library(patchwork)
> (betaUnifPlots$LLsurface + betaUnifPlots$qqPlot)/betaUnifPlots$pValHist

image

(See top right)

With BioNet:

> BioNet::fitBumModel(simPvals) |> BioNet:::plot.bum()

image

The Beta-Uniform model fits are correct (inspect the parameters), but the qqplots are wrong

How

There is clearly something wrong with the plot command. There should really be a test against an exact model fit plot too.