saigegit / SAIGE

Development for SAIGE and SAIGE-GENE(+)
GNU General Public License v3.0
66 stars 29 forks source link

First variance component is 0. Error in analysing quantitative trait. #23

Closed mkierczak closed 2 years ago

mkierczak commented 2 years ago

Hi!

I use real data and simulate normally distributed quantitative phenotype. When I run SAIGE 1.0.4 fit null model:

               echo "Fitting null model for: {wildcards.trait}"
                singularity run {params.container_path} Rscript {params.bin_path}/step1_fitNULLGLMM.R \
                --plinkFile={params.input_prefix} \
                --phenoFile={input.pheno} \
                --phenoCol={wildcards.trait} \
                --sampleIDColinphenoFile={params.id_column} \
                --traitType=quantitative \
                --invNormalize=TRUE \
                --memoryChunk=2 \
                --outputPrefix={params.out_prefix} \
                --nThreads={threads} \
                --LOCO=FALSE \
                --tauInit=1,0 \
                --IsOverwriteVarianceRatioFile=TRUE \
                --skipVarianceRatioEstimation=FALSE \
                --useSparseGRMtoFitNULL=TRUE \
                --sparseGRMFile={input.grm} \
                --sparseGRMSampleIDFile={input.grm_sample}

, I get the following error:

use sparse kinship to fit the model
use sparse kinship to fit the model
use sparse kinship to fit the model
use sparse kinship to fit the model
use sparse kinship to fit the model
cov:  0.01529698
Variance component estimates:
[1] 0.0000000 0.9656428
Fixed-effect coefficients:
            [,1]
[1,] -0.03081812
Error in glmmkin.ai_PCG_Rcpp_Quantitative(plinkFile, Xorig, isCovariateOffset,  :
  ERROR! The first variance component parameter estimate is 0
Calls: fitNULLGLMM -> system.time -> glmmkin.ai_PCG_Rcpp_Quantitative
Timing stopped at: 2.788 0.507 3.483
Execution halted

Any hints as to what the problem can be (tried LOCO=TRUE too, same...)?

mkierczak commented 2 years ago

OK, when I increase the variance of my simulated traits, the problem disappears. Still, looks like a limitation of the variance estimation algorithm that you may consider addressing in future releases perhaps...