Description Usage Arguments Details Value Note Author(s) References See Also Examples
[TEXT]
1 | poison_regression_permute(wgs_path_count, n.total, n.gr1, n.gr2, email)
|
wgs_path_count |
[TEXT] |
n.total |
[TEXT] |
n.gr1 |
[TEXT] |
n.gr2 |
[TEXT] |
email |
[TEXT] |
[TEXT]
[TEXT]
no further notes
dlemas
[TEXT]
[TEXT]
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (wgs_path_count, n.total, n.gr1, n.gr2, email)
{
library(gtools)
library(mail)
ptm <- proc.time()
df.pathway.new = wgs_path_count[, -1]
rownames(df.pathway.new) = NULL
colnames(df.pathway.new) = NULL
data2 = data.matrix(df.pathway.new)
Y <- c(rep(1, n.gr1), rep(0, n.gr2))
I <- combinations(n = n.total, r = n.gr2, set = FALSE, repeats.allowed = FALSE)
permY <- matrix(nrow = nrow(I), ncol = n.total, 0)
for (i in 1:nrow(permY)) permY[i, I[i, ]] <- 1
PVALUES <- NULL
for (i in 1:nrow(data2)) {
ans <- summary(glm(data2[i, ] ~ Y, family = poisson(link = "log")))
obs.LRTS <- ans$null.deviance - ans$deviance
perm.LRTS <- apply(permY, MARGIN = 1, function(x) {
ans <- summary(glm(data2[i, ] ~ x, family = poisson(link = "log")))
ans$null.deviance - ans$deviance
})
PVALUES <- c(PVALUES, mean(perm.LRTS >= obs.LRTS))
}
stop = c(proc.time() - ptm)
stop[1]
message.detail = paste("Calculation finished. Total Run Time: ",
round(stop[1], digits = 2), " seconds", sep = "")
email.notification = sendmail(email, subject = "Notification from R: poison_regression_permute complete",
message = message.detail, password = "rmail")
return(wgs_path_count.new = cbind(wgs_path_count, PVALUES))
return(email.notification)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.