Search
Question: Error in ebayes in limma when analyzing GTEx data
0
gravatar for Darklings
6 months ago by
Darklings0
Darklings0 wrote:

Hi there,

I am building a linear model to analyze the expression profiles of cvd and non-cvd subjects. There are 227 samples here. 

When fitting the model:

design = model.matrix(~ race + age + bmi + gender + batch + cvd + subject)
fit = lmFit(voomOutput, design)
fit = eBayes(fit)
tt  = topTable(fit, number=Inf, genelist=gl, coef="cvd1.0")

Then I got the error:

Coefficients not estimable: subjectGTEX-139TT subjectGTEX-RU72 subjectGTEX-ZAJG subjectGTEX-ZDXO subjectGTEX-ZYFD subjectGTEX-ZYY3 subjectGTEX-ZZPT 
Coefficients not estimable: subjectGTEX-139TT subjectGTEX-RU72 subjectGTEX-ZAJG subjectGTEX-ZDXO subjectGTEX-ZYFD subjectGTEX-ZYY3 subjectGTEX-ZZPT 
Error in .ebayes(fit = fit, proportion = proportion, stdev.coef.lim = stdev.coef.lim,  : 
  No residual degrees of freedom in linear model fits
In addition: Warning message:
Partial NA coefficients for 30333 probe(s) 

And

> str(design)
 num [1:227, 1:158] 1 1 1 1 1 1 1 1 1 1 ...
 - attr(*, "dimnames")=List of 2
  ..$ : chr [1:227] "1" "2" "3" "4" ...
  ..$ : chr [1:158] "(Intercept)" "race2" "race3" "race99" ...
 - attr(*, "assign")= int [1:158] 0 1 1 1 2 3 4 5 5 5 ...
 - attr(*, "contrasts")=List of 5
  ..$ race   : chr "contr.treatment"
  ..$ gender : chr "contr.treatment"
  ..$ batch  : chr "contr.treatment"
  ..$ cvd    : chr "contr.treatment"
  ..$ subject: chr "contr.treatment"

 

> head(subject)
[1] GTEX-111FC GTEX-1128S GTEX-117XS GTEX-1192X GTEX-11DXW GTEX-11DXY
148 Levels: GTEX-111FC GTEX-1128S GTEX-117XS GTEX-1192X GTEX-11DXW GTEX-11DXY ... GTEX-ZZPT

It seems that there is something wrong in the design matrix, I see the same questions in other posts and learn that "No residual degrees of freedom in linear model fits" means no sample has replicates.

But I am still a bit confused about what causes this error in my case. And how can I resolve it?

Thanks.

 

edit:

> sessionInfo()
R version 3.4.2 (2017-09-28)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS High Sierra 10.13.1

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib

locale:
[1] C

attached base packages:
[1] parallel  stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] gplots_3.0.1         metagenomeSeq_1.20.1 glmnet_2.0-13        Matrix_1.2-12       
 [5] RColorBrewer_1.1-2   doParallel_1.0.11    iterators_1.0.9      foreach_1.4.4       
 [9] limma_3.34.9         Biobase_2.38.0       BiocGenerics_0.24.0 

loaded via a namespace (and not attached):
 [1] lattice_0.20-35    matrixStats_0.53.1 codetools_0.2-15   gtools_3.5.0      
 [5] bitops_1.0-6       grid_3.4.2         KernSmooth_2.23-15 gdata_2.18.0      
 [9] tools_3.4.2        compiler_3.4.2     caTools_1.17.1 

 

ADD COMMENTlink modified 6 months ago • written 6 months ago by Darklings0

Post your session information. Make sure you're using the latest version of limma (3.34.9).

ADD REPLYlink modified 6 months ago • written 6 months ago by Aaron Lun21k
2
gravatar for Gordon Smyth
6 months ago by
Gordon Smyth35k
Walter and Eliza Hall Institute of Medical Research, Melbourne, Australia
Gordon Smyth35k wrote:

The whole approach of including 'subject' in the design matrix is inappropriate here. You are wanting to test for a difference between two groups of subjects (cvd vs non-cvd) so it makes no sense to correct the data for subject differences first. That would remove the cvd vs non-cvd differences together with everything else of interest.

It would be worthwhile to investigate why there are multiple samples from the same subject anyway. That cannot help with your primary question.

As far as the specific error message is concerned, I would have thought it to be impossible to get the error message you show from the run that you seem to have done. If you have used voom, there there can't be any NA values in your expression data. Without NAs, it is impossible to have no residual df from a dataset of 227 samples and a design matrix with 158 columns. There must be other things going on that you haven't shown us.

ADD COMMENTlink modified 6 months ago • written 6 months ago by Gordon Smyth35k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.2.0
Traffic: 355 users visited in the last hour