Diff for "FAQ/Rfishp" - CBU statistics Wiki
location: Diff for "FAQ/Rfishp"
Differences between revisions 2 and 4 (spanning 2 versions)
Revision 2 as of 2008-04-25 11:46:38
Size: 689
Editor: PeterWatson
Comment:
Revision 4 as of 2013-03-08 10:17:40
Size: 546
Editor: localhost
Comment: converted to 1.6 markup
Deletions are marked like this. Additions are marked like this.
Line 14: Line 14:
pvals <- NA
pf <- function(pl) {
{ if (any(is.na(pl))) { res <- "There was an empty array of p-values"}
else
res <- pfish(pvals) }
return(res)
 }
Line 20: Line 27:
pl <- NA
pl <- length(pvals)
{ if (is.na(pl)) { res <- "There was an empty array of p-values"}
else
res <- pfish(pvals) }
print(res)
pf(pvals)
Line 32: Line 34:

(I hope to improve this so that only the pvals vector needs to be entered for each run with the check to see if the p-value vector is empty done less obtrusively!)

R code for combining p-values using Bailey and Gribskov (1998) method

pfish <- function(p) {

t <- prod(p)
x <- -log(prod(p))
n <- length(p)
v <- c(1:n-1)
a <- t*(x^v)/factorial(v)
pf <- sum(a)
return(pf)
}
pvals <- NA
pf <- function(pl) {
{ if (any(is.na(pl))) { res <- "There was an empty array of p-values"}
else
res <- pfish(pvals) }
return(res)
 }

Running this inputting a list of pvalues on vector pvals

pvals <- c(0.1,0.01,0.01,0.7,0.3,0.1)
pf(pvals)

we get

[1] 0.002148704

None: FAQ/Rfishp (last edited 2013-03-08 10:17:40 by localhost)