1 | permute.residuals.iter(mat, mod, mod0, iterations = c(200, 5000, 1e+05, 2e+06), p_samples = 1, mc.cores = 12)
|
mat |
|
mod |
|
mod0 |
|
iterations |
|
p_samples |
|
mc.cores |
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 | ##---- 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 (mat, mod, mod0, iterations = c(200, 5000, 1e+05, 2e+06),
p_samples = 1, mc.cores = 12)
{
stopifnot(nrow(mod) == ncol(mat))
subset = rep(TRUE, nrow(mat))
df = NA
for (it in iterations) {
message(paste("sampling", sum(subset), "rows", it, "times"))
if (any(is.na(df))) {
df = permute.residuals(mat, mod, mod0, it, p_samples,
mc.cores)
}
else {
df[subset, ] = permute.residuals(mat[subset, ], mod,
mod0, it, p_samples, mc.cores)
}
df[subset, "samples"] = it
subset = (df$pvalue <= (2/it))
if (sum(subset) == 0) {
break
}
}
df
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.