Skip to content
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

Problem with inflated pseudocounts from EmpiricalBayesPrior #2

Open
Jayesh-Kumar-Sundaram opened this issue Feb 6, 2023 · 0 comments

Comments

@Jayesh-Kumar-Sundaram
Copy link

EmpiricalBayesPrior=function(A,B) {

u=A>0 | B>0
A=A[u]
B=B[u]

x=median(log(A)-log(B))
y=max((quantile(log(A)-log(B),pnorm(1))-x)^2,(-quantile(log(A)-log(B),pnorm(-1))+x)^2)
if (is.infinite(x) || is.infinite(y)) {
    x=mean(log(A+1)-log(B+1))
    y=var(log(A+1)-log(B+1))
}
opt.fun=function(v) (digamma(v[1])-digamma(v[2])-x)^2+(trigamma(v[1])+trigamma(v[2])-y)^2
optim(c(1,1),opt.fun)$par

}

This is regarding the EmpiricalBayesPrior function. For some of my data it gives me a huge difference in pseudocounts as prior (For example: (0.16,208)). I see that I have good number of genes are detected only in B condition when compared to A condition in my case. I feel that it is probably biasing the estimation. Why did you use "x=median(log(A)-log(B))" first and then "x=mean(log(A+1)-log(B+1))" inside the if{}? I feel like having median function inside if{} might help my case. Any comments?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant