Errors and warnings in variancePartition
are mostly
designed to let the user know that there is an isssue with the model.
Note that some of these warnings and errors can be overridden by
specifying hideErrorsInBackend=TRUE
for
dream()
and showWarnings=FALSE
for
fitExtractVarPartModel()
and
fitVarPartModel()
.
dream()
The linear mixed model used by dream()
can be a little
fragile for small sample sizes and correlated covariates.
Initial model failed: the fixed-effects model matrix is column rank deficient (rank(X) = 3 < 4 = p); the fixed effects will be jointly unidentifiable
The design matrix has redundant variables, so the model is singular
and coefficients can’t be estimated. Fix by dropping one or more
variables. Use canCorPairs()
to examine correlation
betweeen variables.
The most common issue is when dream()
analysis succeeds
for most genes, but a handful of genes fail. These genes can fail if the
iterative process of fitting the linear mixed model does not converge,
or if the estimated covariance matrix that is supposed be positive
definite has an eigen-value that is negative or too close to zero due to
rounding errors in floating point arithmetic.
In these cases, dream()
gives a warning that the model
has failed for a subset of genes, and also provides the gene-level
errors. All successful model fits are returned to be
used for downstream analysis.
Here we demonstrate how dream()
handles model fits:
library(variancePartition)
data(varPartData)
# Redundant formula
# This example is an extreme example of redundancy
# but more subtle cases often show up in real data
form <- ~ Tissue + (1 | Tissue)
fit <- dream(geneExpr[1:30, ], form, info)
## Warning in dream(geneExpr[1:30, ], form, info): Model failed for 29 responses.
## See errors with attr(., 'errors')
# Extract gene-level errors
attr(fit, "errors")[1:2]
## gene1
## "Error in lmerTest:::as_lmerModLT(model, devfun, tol = tol): (converted from warning)
## Model may not have converged with 1 eigenvalue close to zero: -2.0e-09\n"
## gene2
## "Error: (converted from warning) Model failed to converge
## with 1 negative eigenvalue: -1.5e-08\n"
## R version 4.4.2 (2024-10-31)
## Platform: x86_64-pc-linux-gnu
## Running under: Ubuntu 24.04.1 LTS
##
## Matrix products: default
## BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
## LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.26.so; LAPACK version 3.12.0
##
## locale:
## [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8
## [4] LC_COLLATE=C LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
## [7] LC_PAPER=en_US.UTF-8 LC_NAME=C LC_ADDRESS=C
## [10] LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
##
## time zone: Etc/UTC
## tzcode source: system (glibc)
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## other attached packages:
## [1] edgeR_4.5.0 pander_0.6.5 variancePartition_1.37.1
## [4] BiocParallel_1.41.0 limma_3.63.2 ggplot2_3.5.1
## [7] knitr_1.49 rmarkdown_2.29
##
## loaded via a namespace (and not attached):
## [1] tidyselect_1.2.1 farver_2.1.2 dplyr_1.1.4 bitops_1.0-9
## [5] fastmap_1.2.0 digest_0.6.37 lifecycle_1.0.4 statmod_1.5.0
## [9] magrittr_2.0.3 compiler_4.4.2 rlang_1.1.4 sass_0.4.9
## [13] tools_4.4.2 utf8_1.2.4 yaml_2.3.10 labeling_0.4.3
## [17] plyr_1.8.9 KernSmooth_2.23-24 withr_3.0.2 purrr_1.0.2
## [21] numDeriv_2016.8-1.1 BiocGenerics_0.53.2 sys_3.4.3 grid_4.4.2
## [25] aod_1.3.3 fansi_1.0.6 caTools_1.18.3 colorspace_2.1-1
## [29] scales_1.3.0 gtools_3.9.5 iterators_1.0.14 MASS_7.3-61
## [33] cli_3.6.3 mvtnorm_1.3-2 generics_0.1.3 reshape2_1.4.4
## [37] minqa_1.2.8 cachem_1.1.0 stringr_1.5.1 splines_4.4.2
## [41] parallel_4.4.2 matrixStats_1.4.1 vctrs_0.6.5 boot_1.3-31
## [45] Matrix_1.7-1 jsonlite_1.8.9 pbkrtest_0.5.3 maketools_1.3.1
## [49] locfit_1.5-9.10 jquerylib_0.1.4 tidyr_1.3.1 snow_0.4-4
## [53] glue_1.8.0 nloptr_2.1.1 codetools_0.2-20 stringi_1.8.4
## [57] gtable_0.3.6 EnvStats_3.0.0 lme4_1.1-35.5 lmerTest_3.1-3
## [61] munsell_0.5.1 tibble_3.2.1 remaCor_0.0.18 pillar_1.9.0
## [65] htmltools_0.5.8.1 gplots_3.2.0 R6_2.5.1 Rdpack_2.6.1
## [69] evaluate_1.0.1 lattice_0.22-6 Biobase_2.67.0 rbibutils_2.3
## [73] backports_1.5.0 RhpcBLASctl_0.23-42 broom_1.0.7 fANCOVA_0.6-1
## [77] corpcor_1.6.10 bslib_0.8.0 Rcpp_1.0.13-1 nlme_3.1-166
## [81] xfun_0.49 buildtools_1.0.0 pkgconfig_2.0.3