Description Usage Arguments Format Details Value Author(s) Examples
functions that are called inside permutationPval
extract and match attribute column names to data.tables that contain nodes which those attributes describe
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 | permutationPvalHelper
formula2colnames(node_attr, cols, nodes)
node_attr2colnames(node_attr, cols, nodes)
formula2nodes(interactions2permute, associations2test)
checkSelectNodes(select_nodes, node_attr, nodes, cols)
checkSelectNodesList(select_nodes, node_attr, nodes, cols)
filterByFormula(data_list, select_nodes, cols, nodes)
filterByList(data_list, select_nodes, cols, nodes)
calcObservedStatistic(data_list, by_cols, exprs, nodes, nodes_call,
includeAssociations)
calcPermutedStatistic(data_list, by_cols, exprs, nodes, nodes_call,
includeAssociations, also_permuteYZ)
observedVSpermuted(data_list, nodes_call, nodes)
aggregatePermutations(temp, nodes, nodes_call)
|
cols |
list of column names |
nodes |
list of node names (column names for columns that contain node names) |
data_list |
list that contains data.tables necessary for these functions to work |
by_cols |
modified left-hand side of |
exprs |
right-hand side of |
nodes_call |
list of node names, each class call (to be evaluated within data.table expressions DT[,eval(nodes_call$nodeX)]) |
includeAssociations |
logical, if calculating statistic requires columns that contain attribute of X-Z pair associations table will be merged |
inheritParams |
permutationPval |
An object of class NULL
of length 0.
formula2colnames
extracts nodes, extracts attributes, attaches attributes to a table if all nodes are present in that table and in case of associations table both varibles in a formula should be nodeX and nodeZ
formula2nodes
reorders node column names so that regardless of their order in formula we later permute XY interactions and test for XZ associations
checkSelectNodes
checks if you want to select nodes based on the attributes of those nodes + splits a formula which selects a combination of nodes based on their shared properties (like count of X and Z pairs) into a list of formulas each selecting separate nodes
checkSelectNodesList
calls checkSelectNodes
for each element in a list (or formula) select_nodes
and each element in a list (or formula) node_attr
. If select_nodes
or node_attr
is a formula then it is converted to a list of 1L
filterByFormula
filters one or 2 of the XY, YZ or association tables based on a condition defining which nodes to keep (only one node type: X, Y or Z)
filterByList
filters one or 2 of the XY, YZ or association tables based on a condition defining which nodes to keep (only one node type: X, Y or Z), takes a list of formulas or a formula as an argument
calcObservedStatistic
calculates Observed Statistic by evaluating exprs
by by_cols
, also calculates how many nodes Y are missing node Z for each node X, saves result to data_list$observed
. includeAssociations specifies if exprs
required any attributes of both X and Z.
calcPermutedStatistic
calculates Permuted Statistic by permuting node Y column in XY (and, optionally in YZ, if also_permuteYZ
is true) and calculating statistic by evaluating exprs
by by_cols
, unlike calcObservedStatistic
doesn't calculate how many nodes Y are missing node Z for each node X. Saves result to data_list$permuted
.
observedVSpermuted
compares Observed Statistic to Permuted Statistic, records how many times permuted statistic is at least as large as the observed statistic (higher_counts
) and how many of X-Z pairs have non-NA Observed Statistic or Permuted Statistic (not_missing
). In each permutation round, node X might have many nodes Z, so when calculating empirical p-value all these comparisons should be counted (not just the number of permutations). On the other hand, not in all permutation rounds a specific observed XZ pair might occur, so we need to cound non-NA "Observed Statistic to Permuted Statistic" comparisons
aggregatePermutations
aggregates the result of observedVSpermuted
from many permutation rounds (output of replicate, class matrix)
formula2colnames
returns list of column names for XY, YZ and association tables
node_attr2colnames
returns the same as formula2colnames
but when node_attr2colnames is a list of formulas
formula2nodes
returns list of 3 node column names extracted from formulas supplied through interactions2permute
, associations2test
checkSelectNodes
returns a formula or a list of formulas if they have passed the check - error if otherwise
checkSelectNodesList
returns a list of formulas (even of lenght 1) if they have passed the check - error if otherwise
filterByFormula
returns data_list in which interactionsXY, interactionsYZ, associations data.table-s were filtered by formula
filterByList
returns data_list in which interactionsXY, interactionsYZ, associations data.table-s were filtered by each formula if select_nodes was a list
calcObservedStatistic
returns data_list
calcPermutedStatistic
returns data_list
observedVSpermuted
returns data.table contatining the following columns: "higher_counts", "not_missing", nodeX names, nodeZ names
aggregatePermutations
returns the data.table of the same format as observedVSpermuted
Vitalii Kleshchevnikov
1 2 3 4 5 6 7 8 9 10 11 | ## Not run: cols = formula2colnames(node_attr, cols, nodes)
## Not run: cols = node_attr2colnames(node_attr, cols, nodes)
## Not run: nodes = formula2nodes(interactions2permute, associations2test)
## Not run: select_nodes = checkSelectNodes(select_nodes, node_attr, nodes, cols)
## Not run: select_nodes = checkSelectNodesList(select_nodes, node_attr, nodes, cols)
## Not run: data_list = filterByFormula(data_list, select_nodes, cols, nodes)
## Not run: data_list = filterByList(data_list, select_nodes, cols, nodes)
## Not run: data_list = calcObservedStatistic(data_list, by_cols, exprs, nodes, nodes_call, includeAssociations)
## Not run: data_list = calcPermutedStatistic(data_list, by_cols, exprs, nodes, nodes_call, includeAssociations, also_permuteYZ)
## Not run: data_list_temp = MItools:::observedVSpermuted(data_list, nodes_call, nodes)
## Not run: temp2_inner = MItools:::aggregatePermutations(temp_inner, nodes, nodes_call)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.