markvdwiel / ShrinkBayes

R package for differential expression: sequencing counts (RNAseq), microarrays, and HTRNAi
3 stars 1 forks source link

Error in sum(whnull) : invalid 'type' (list) of argument #3

Open amcdavid opened 7 years ago

amcdavid commented 7 years ago

Not sure what's going on. Do you have data rows with only zeros? Maybe wise to filter those out. Sure, yuo may send me a small part of the data which gives an error.

Hi, I am trying to fit a zero-inflated negative binomial model to large (N=2350), very sparse (13% non-zero) data but get the above error. The data is also high-dimensional, but I figured I would try to get the model to fit on a subset before burning too many CPU cycles.

The analogous ZINB model fits without error in the CAGEdata1000 set. I don't see a way to attach a file here, but I can email you the data I am trying to fit.

library(data.table)
library(ShrinkBayes)
counts = as.matrix(fread('count_table.csv'))
covariates = fread('covariates.csv')
form = ~ treatment+1+SPngo.1 + SPngo.2+ f(plate)
treatment = covariates$treatment
SPngo.1 = covariates$SPngo.1
SPngo.2 = covariates$SPngo.2
plate = covariates$plate
sbw <- ShrinkBayesWrap(counts, form, ncpus2use = 1, maxiter=2, fams='zinb')

[1] "Performing inference (testing) for parameter(s): treatment" [1] "Performing regression-based test" [1] "STARTING INITIAL SHRINKAGE" $mufixed [1] 0 $precfixed [1] 0.1 $muaddfixed [1] 0 $precaddfixed [1] 0.1 $shaperand [1] 1 $raterand [1] 1e-05 $shapeaddr [1] 1 $rateaddr [1] 1e-05

$mup0 [1] 0

$precp0 [1] 0.01

$mudisp [1] 0

$precdisp [1] 0.01

$mixp [1] 0.2 0.8

[1] "iter= 1" [1] "ntagsused= 50" [1] "NOTE: Warnings from INLA (eigenvalues, convergence, abort) can currently not be surpressed. Please ignore (generally)" [1] "ntags not used: 0" [1] "ntags not used: 0" [1] -2479.196 [1] Inf mufixed precfixed muaddfixed precaddfixed shaperand 0.0000000 Inf 0.0000000 0.1000000 1.0000000 raterand shapeaddr rateaddr mup0 precp0 0.0000100 1.0000000 0.0000100 0.0000000 0.0100000 mudisp precdisp mixp1 mixp2 nfeat -1.8420358 0.3169499 0.0000000 1.0000000 50.0000000 meanmlik -2479.1956000 mufixed precfixed muaddfixed precaddfixed shaperand raterand 0.0000000 Inf 0.0000000 0.0000000 0.0000000 0.0000000 shapeaddr rateaddr mup0 precp0 mudisp precdisp 0.0000000 0.0000000 0.0000000 0.0000000 -1.8420358 0.3069499 mixp1 mixp2 nfeat meanmlik -0.2000000 0.2000000 NA NA KSfixed KSmaxaddfixed KSlogdisp KSlogitp0 KSrandomprec KS 0.5 0.09974769 0.4104487 0 0 [1] "iter= 2" [1] "ntagsused= 50" [1] "Point mass has zero mass...fitting full model only." [1] "ntags not used: 0" [1] "ntags not used: 0" [1] -2479.196 -2479.124 [1] 2.904252e-05 mufixed precfixed muaddfixed precaddfixed shaperand 0.0000000 Inf 0.0000000 0.1000000 1.0000000 raterand shapeaddr rateaddr mup0 precp0 0.0000100 1.0000000 0.0000100 0.0000000 0.0100000 mudisp precdisp mixp1 mixp2 nfeat -1.8420358 0.3169499 0.0000000 1.0000000 50.0000000 meanmlik -2479.1956000 mufixed precfixed muaddfixed precaddfixed shaperand raterand 0 NaN 0 0 0 0 shapeaddr rateaddr mup0 precp0 mudisp precdisp 0 0 0 0 0 0 mixp1 mixp2 nfeat meanmlik 0 0 0 0 KSfixed KSmaxaddfixed KSlogdisp KSlogitp0 KSrandomprec KS 0.5 0.09974769 0.4104487 0 0 [1] "Computing time for shrinkage:" user system elapsed 1101.619 48.665 1197.569 [1] "STARTING INITIAL FIT" [1] "IF YOU DO NOT INTEND TO USE EITHER OF THE FUNCTIONS MixtureUpdatePrior OR NonParaUpdatePrior \nPLEASE USE finalprior=TRUE" [1] "NOTE: Warnings from INLA (eigenvalues, convergence, abort) can currently not be surpressed. Please ignore (generally)"

[1] "Approximating marginal likelihood for null model by Savage-Dickey" Set 'approx0 <- FALSE' when this is not desired. [1] "Computing time for initial fit:" user system elapsed 497.153 24.257 544.086 [1] "START FITTING MIXTURE PRIOR" Error in sum(whnull) : invalid 'type' (list) of argument

sessionInfo()

R version 3.3.2 (2016-10-31) Platform: x86_64-apple-darwin13.4.0 (64-bit) Running under: macOS Sierra 10.12.4

locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages: [1] splines stats4 stats graphics grDevices utils datasets [8] methods base

other attached packages: [1] ShrinkBayes_2.13.4 rgl_0.98.1 XML_3.98-1.7
[4] Iso_0.0-17 logcondens_2.1.5 mclust_5.2.3
[7] VGAM_1.0-3 INLA_0.0-1485844051 Matrix_1.2-10
[10] sp_1.2-4 snowfall_1.84-6.1 snow_0.4-2
[13] data.table_1.10.4 knitr_1.15.1 devtools_1.13.1

loaded via a namespace (and not attached): [1] Rcpp_0.12.10 compiler_3.3.2 ks_1.10.6 tools_3.3.2
[5] digest_0.6.12 jsonlite_1.4 memoise_1.1.0 lattice_0.20-35
[9] shiny_1.0.3 multicool_0.1-10 mvtnorm_1.0-6 withr_1.0.2
[13] htmlwidgets_0.8 grid_3.3.2 R6_2.2.1 magrittr_1.5
[17] codetools_0.2-15 htmltools_0.3.6 misc3d_0.8-4 mime_0.5
[21] xtable_1.8-2 httpuv_1.3.3 KernSmooth_2.23-15 FNN_1.1