permutationMC: Permute group labels

Description Usage Arguments Value References Examples

View source: R/omicslondaMCPermutation.R

Description

Permutes the group label of the samples in order to construct the testStatistics empirical distibution

Usage

1
2
permutationMC(formula = Count ~ Time, perm.dat = NULL, n.perm = 500,
  fit.method = "ssgaussian", points, parall = FALSE, prefix = "Test")

Arguments

formula

formula to be passed to the regression model

perm.dat

dataframe has the Count, Group, Subject, Time

n.perm

number of permutations

fit.method

The fitting method (ssgaussian)

points

The points at which the prediction should happen

parall

boolean to indicate whether to use multicore.

prefix

prefix to be used to create directory for the analysis results

Value

a list of the fitted model for each group for all the permutations

References

Ahmed Metwally (ametwall@stanford.edu)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
library(SummarizedExperiment)
data("omicslonda_data_example")
omicslonda_se_object_adjusted = adjustBaseline(
    se_object = omicslonda_data_example$omicslonda_se_object)
omicslonda_test_object = omicslonda_se_object_adjusted[1,]
se_object = omicslonda_test_object
dt = data.frame(colData(se_object))
dt$Count = as.vector(assay(se_object))
Group = as.character(dt$Group)
group.levels = sort(unique(Group))
gr.1 = as.character(group.levels[1])
gr.2 = as.character(group.levels[2])
df = dt
levels(df$Group) = c(levels(df$Group), "0", "1")
df$Group[which(df$Group == gr.1)] = 0
df$Group[which(df$Group == gr.2)] = 1
group.0 = df[df$Group == 0, ]
group.1 = df[df$Group == 1, ]
points = seq(100, 130)
perm  = permutationMC(formula = Count ~ Time, perm.dat = df, n.perm = 10,
                      fit.method = "ssgaussian", points = points,
                      parall = FALSE, prefix = tempfile())

aametwally/OmicsLonDA documentation built on Feb. 10, 2020, 11:47 a.m.