simData {sumSome} | R Documentation |
Simulating Matrix of Statistics
Description
This function simulates a matrix of permutation statistics, by performing a t test on normal data.
Usage
simData(prop, m, B = 200, rho = 0, n = 50, alpha = 0.05, pw = 0.8, p = TRUE, seed = NULL)
Arguments
prop |
proportion of non-null hypotheses. |
m |
total number of variables. |
B |
number of permutations, including the identity. |
rho |
level of equicorrelation between pairs of variables. |
n |
number of observations. |
alpha |
significance level. |
pw |
power of the t test. |
p |
logical, |
seed |
seed. |
Details
The function applies the one-sample two-sided t test to a matrix of simulated data,
for B
data permutations.
Data is obtained by simulating n
independent observations from a multivariate normal distribution,
where a proportion prop
of the variables has non-null mean.
This mean is such that the one-sample t test with significance level alpha
has power equal to pw
.
Each pair of distinct variables has equicorrelation rho
.
Value
simData
returns a matrix where the B
rows correspond to permutations (the first is the identity),
and the m
columns correspond to variables.
The matrix contains p-values if p
is TRUE
, and t-scores otherwise.
The first columns (a proportion prop
) correspond to non-null hypotheses.
Author(s)
Anna Vesely.
See Also
True discovery guarantee: sumStats
, sumPvals
Examples
# generate matrix of p-values for 5 variables and 10 permutations
G <- simData(prop = 0.6, m = 5, B = 10, alpha = 0.4, seed = 42)
# subset of interest (variables 1 and 2)
S <- c(1,2)
# create object of class sumObj
# combination: harmonic mean (Vovk and Wang with r = -1)
res <- sumPvals(G, S, alpha = 0.4, r = -1)
res
summary(res)
# lower confidence bound for the number of true discoveries in S
discoveries(res)
# lower confidence bound for the true discovery proportion in S
tdp(res)
# upper confidence bound for the false discovery proportion in S
fdp(res)