fun.comparepower: Compare power of various one- and two-sample tests via...

View source: R/comparepower.R

fun.comparepowerR Documentation

Compare power of various one- and two-sample tests via simulation.

Description

Compare power of various one- and two-sample tests via simulation.

Usage

fun.comparepower(
  samp1sz = 10,
  samp2sz = NA,
  dist = "rnorm",
  ndim = 1,
  distb = NULL,
  level = 0.05,
  hypoth = 0,
  nsamp = 1000,
  alternative = "two.sided",
  altvalue = NULL,
  flip = F
)

Arguments

samp1sz

the size of the first sample.

samp2sz

the size of the second sample. Defaults to NA, triggering one-sample tests.

dist

vector of names of random number generators, determinating distributions to be compared. Defaults to just normal.

ndim

Dimension of distributions to be compared. Defaults to one.

distb

vector of names of random number generators for second sample. Defaults to distribution for the first sample.

level

level of tests.

hypoth

vector null hypothesis values. For uniform on [0,1] this should be taken as .5.

nsamp

Number of Monte Carlo samples.

alternative

alternative, of the form aceptable by t.test, z.test, binom.test, and wilcox.test. Defaults to "two.sided". Can be a vector.

altvalue

vector of alternative hypothesis values. Defaults to null value for calculation of actual test level.

flip

logical indicator to allow asymetric distributions to be flipped.

Details

Tests are given by fun.onesampletests or fun.twosampletests, as appropriate.

Value

A five-dimensional array of test levels (if altevalue equals hypoth) or power otherwise. Dimensions are test, distribution, alternative, alternative value, and first dimension sample size.

Examples

fun.comparepower(10,15,nsamp=100)


kolassa-dev/NonparametricHeuristic documentation built on Nov. 14, 2022, 11:25 p.m.