twosample_power {R2sample} | R Documentation |
Find the power of various two sample tests using Rcpp and parallel computing.
Description
Find the power of various two sample tests using Rcpp and parallel computing.
Usage
twosample_power(
f,
...,
TS,
TSextra,
alpha = 0.05,
B = c(1000, 1000),
nbins = c(50, 10),
minexpcount = 5,
UseLargeSample,
samplingmethod = "independence",
maxProcessor = 10
)
Arguments
f |
function to generate a list with data sets x, y and (optional) vals, weights |
... |
additional arguments passed to f, up to 2 |
TS |
routine to calculate test statistics for non-chi-square tests |
TSextra |
additional info passed to TS, if necessary |
alpha |
=0.05, the level of the hypothesis test |
B |
=c(1000, 2000), number of simulation runs for power and permutation test. |
nbins |
=c(50,10), number of bins for chi large and chi small. |
minexpcount |
=5 minimum required count for chi square tests |
UseLargeSample |
should p values be found via large sample theory if n,m>10000? |
samplingmethod |
=independence or MCMC in discrete data case |
maxProcessor |
=10, maximum number of cores to use. If maxProcessor=1 no parallel computing is used. |
Value
A numeric vector of power values.
Examples
f=function(mu) list(x=rnorm(25), y=rnorm(25, mu))
twosample_power(f, mu=c(0,2), B=c(100, 100), maxProcessor = 1)
f=function(n, p) list(x=table(sample(1:5, size=1000, replace=TRUE)),
y=table(sample(1:5, size=n, replace=TRUE,
prob=c(1, 1, 1, 1, p))), vals=1:5)
twosample_power(f, n=c(1000, 2000), p=c(1, 1.5), B=c(100, 100), maxProcessor = 1)
[Package R2sample version 2.2.0 Index]