-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Residual Variance Estimate Failed - Negative Value #162
Comments
we recommend to use If the PIP=0 with this setting then |
sorry for my late response.
|
@tianwen0003 Which link cannot be opened exactly? |
Sorry, the link is |
Thanks. It should be this: |
then PIP should not be 0 with
When using summary data ( |
Sorry, I checked the results,
I found in the guide from https://stephenslab.github.io/susieR/articles/finemapping_summary_statistics.html, the suggestion is set |
can you provide the code you run to apply susie to these input files so we can reproduce the problem? |
Sure, the code and input files are follows: |
I'm in the middle of something else and have to run now ... but here is what I have so far: library(stringr)
library(susieR)
set.seed(1)
gene <- c("ENSG00000149084.7")
print(gene)
qtlResult <- read.table(file = str_c(gene,".data"),sep = "\t",header = F)
ldMatrix <- as.matrix(read.table(file = str_c(gene,".ld"),sep = " ",header = F))
ldMatrix <- ldMatrix[1:dim(ldMatrix)[1],1:dim(ldMatrix)[1]]
expression_var <- 0.960491
sampleSize <- 204
fitted_rss1 <- susie_rss(bhat = qtlResult$V2,shat = qtlResult$V3,
n = sampleSize,R = ldMatrix,
var_y = expression_var,
L = 10,
estimate_residual_variance = TRUE) I get
and negative estimate for residual variance. Then I tried: isSymmetric(ldMatrix) # FALSE
krig_res = kriging_rss(qtlResult$V2/qtlResult$V3, ldMatrix, sampleSize)
print(krig_res$plot) I get
Certainly something is wrong with the LD matrix that is supposed to match the genotype; however there is no large difference between observed and expected z-scores. I dont think we have your genotype data to look further into this discrepency. |
The report was that there were problems (PIP=0) even with L=1, for which LD should be irrelevant. So can we check L=1? |
There is one CS using L=1, the estimated residual variance is 0.291. The CS contains 24 variants (perfectly correlated), each with PIP 0.04. |
With estimated residual variance = FALSE, we identify 1 CS with L = 1 - 10. @pcarbo the estimated regularization parameter lambda is 0.0027, the adjusted one also gives an error at L = 4 (estimate_residual_variance = TRUE). The smallest eigenvalue for the LD matrix is -1.6. The LD matrix is from plink, and it's a known issue that there are rounding and numerical errors. @pcarbo @gaow @tianwen0003 Do you know whether the covariate effects are removed from the genotypes in fastqtl? |
@zouyuxin good point about the covariates. The genotype data does not remove the covariates from it -- that'd be one reason the kriging plot is not perfect because the z score and LD can be a bit off because of the covarites is not removed from genotypes. In any case, the data used in susie_rss here is not exactly the "in sample LD" by our definition. |
So with estimate residual variance =False is everything ok?
…On Fri, Jun 10, 2022, 14:11 gaow ***@***.***> wrote:
@zouyuxin <https://github.com/zouyuxin> good point about the covariates.
The genotype data does not remove the covariates from it -- that'd be one
reason the kriging plot is not perfect because the z score and LD can be a
bit off because of the covarites is not removed from genotypes. In any
case, the data used in susie_rss here is not exactly the "in sample LD" by
our definition.
—
Reply to this email directly, view it on GitHub
<#162 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AANXRRP5ZBK3NUTD7Q2HGGLVOOHNTANCNFSM5W4CSZDA>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
The original report was that the Pips were all 0 in that case.
Can we reproduce that?
…On Fri, Jun 10, 2022, 14:24 Matthew Stephens ***@***.***> wrote:
So with estimate residual variance =False is everything ok?
On Fri, Jun 10, 2022, 14:11 gaow ***@***.***> wrote:
> @zouyuxin <https://github.com/zouyuxin> good point about the covariates.
> The genotype data does not remove the covariates from it -- that'd be one
> reason the kriging plot is not perfect because the z score and LD can be a
> bit off because of the covarites is not removed from genotypes. In any
> case, the data used in susie_rss here is not exactly the "in sample LD" by
> our definition.
>
> —
> Reply to this email directly, view it on GitHub
> <#162 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AANXRRP5ZBK3NUTD7Q2HGGLVOOHNTANCNFSM5W4CSZDA>
> .
> You are receiving this because you commented.Message ID:
> ***@***.***>
>
|
it seems a false alarm according to #162 (comment) |
yes, there is no error or pip all =0 when estimate residual variance = FALSE. |
Ok, good then it seems all is well. Maybe we should warn against using estimate residual variance =True with summary data, even with in sample ld? Or just not suggest it.... It seems difficult to be precise about the circumstances when it is ok to use? |
We used the PC1 and PC2 of genotype as covariants for fastqtl |
Hi
I just got the same error(2 out of 3000 runs) as #90 when did fine-mapping by susie_rss function.
Error in susie_suff_stat(XtX = XtX, Xty = Xty, n = n, yty = (n - 1) * :
Estimating residual variance failed: the estimated value is negative
Calls: susie_rss -> susie_suff_stat
Execution halted
when set estimate_residual_variance = FALSE, the function run well but all pip are zero
Here, I provide the all files for you to test
ENSG00000149084.7.vcf.gz
ENSG00000149084.7_fastqtl.zip
In this file, the second column is the "slope" from fastqtl, the thrid column is the "slope_se" from fastqtl
ENSG00000149084.7_ldMatrix.zip
This is the ld matrix calculated from plink --r
the sample number n = 204
var_y = 0.960491
The text was updated successfully, but these errors were encountered: