Skip to content

Instantly share code, notes, and snippets.

@praveenkumarpgiindia
Forked from hakyim/metaanalysis.R
Created October 28, 2018 06:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save praveenkumarpgiindia/7258168a30e7e71d1946ab211b5986a8 to your computer and use it in GitHub Desktop.
Save praveenkumarpgiindia/7258168a30e7e71d1946ab211b5986a8 to your computer and use it in GitHub Desktop.
## meta analysis, sample size based
metaZn = function(zdisc,zrepl,ndisc,nrepl)
{
## calculate meta analysis Zscore
## zdisc and zrepl are zscores in the discovery and replication sets respectively
## ndisc and nrepl are sample sizes in the discovery and replication sets
wdisc = sqrt(ndisc)
wrepl = sqrt(nrepl)
( zdisc * wdisc + zrepl * wrepl )/sqrt( wdisc^2 + wrepl^2 )
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment