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

Isq #2

Open
emyanuthomas opened this issue Aug 15, 2019 · 2 comments
Open

Isq #2

emyanuthomas opened this issue Aug 15, 2019 · 2 comments

Comments

@emyanuthomas
Copy link

Hi,
I was trying to calculate I.sq, but noticed that I.sq reported by mr_egger() function and that manually calculated by the following code shows different results.
Q = sum((Bxse/Byse)^-2*(Bx/Byse-weighted.mean(Bx/Byse, w=(Bxse/Byse)^-2))^2)
Isq = max(0, (Q-(length(Bx)-1))/Q).

For eg. mr_egger(mr_input(bx = ldlc, bxse = ldlcse, by = chdlodds, byse = chdloddsse)) reports Isq = 91.9%
while the following code report Isq= 0.9647499
Bx=ldlc
Bxse = ldlcse
By = chdlodds
Byse = chdloddsse
Q = sum((Bxse/Byse)^-2*(Bx/Byse-weighted.mean(Bx/Byse, w=(Bxse/Byse)^-2))^2)
Isq = max(0, (Q-(length(Bx)-1))/Q)

Can you help me understand why this difference?

@gaborcsardi
Copy link

This is a read only mirror of CRAN, please see the DESCRIPTION file for the package authors.

@sb452
Copy link
Contributor

sb452 commented Jul 28, 2022

It is because some of your bx are positive and others are negative. If you replace with:

Bx=abs(ldlc)
By = chdlodds*sign(ldlc)

then you should get Isq = 91.9%.

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

3 participants