#### /working/auteur/man/randomization.test.Rd

Unknown | 43 lines | 40 code | 3 blank | 0 comment | 0 complexity | da14a29b9657aefb8c5a3fb8026b6d24 MD5 | raw file

1\name{randomization.test} 2\alias{randomization.test} 3\title{statistical comparison of sets of values by randomization} 4\description{Compares means by bootstrap resampling of differences between empirical distributions} 5\usage{ 6randomization.test(obs = obs, exp = exp, mu = 0, iter = 10000, two.tailed = FALSE) 7} 8%- maybe also 'usage' for other objects documented here. 9\arguments{ 10 \item{obs}{a vector of numeric values} 11 \item{exp}{a vector of numeric values} 12 \item{mu}{the true difference in means} 13 \item{iter}{number of randomization comparisons to perform} 14 \item{two.tailed}{as default, the test is performed under a one-tailed assumption; if \code{two.tailed=FALSE}, probability values associated with either tail of the comparison distribution are returned, 15otherwise, a two-tailed result is returned} 16} 17\details{ 18If a single value is supplied for \code{obs}, this test equates to finding the quantile in \code{exp} in which \code{obs} would be found (under a one-tailed test); 19see \bold{Examples} and also \code{\link[stats]{ecdf}}} 20\value{ 21A list, whose contents are determined by the above argument: 22 \item{unnamed value}{if \code{two.tailed=TRUE}, this is the two-tailed p-value} 23 \item{diffs}{the full resampling distribution of differences between \code{obs} and \code{exp}, given \code{mu} } 24 \item{greater}{if \code{two.tailed=FALSE}, this is the p-value associated with the righthand tail} 25 \item{lesser}{if \code{two.tailed=FALSE}, this is the p-value associated with the lefthand tail} 26} 27\author{JM Eastman} 28\examples{ 29 30# a comparison between two distributions 31a=rnorm(n=1000, mean=1, sd=0.5) 32b=rnorm(n=1000, mean=0, sd=1) 33randomization.test(obs=a, exp=b, two.tailed=FALSE) 34 35# a comparison of a single value to a normal distribution 36a=3 37b=rnorm(n=1000, mean=0, sd=1) 38randomization.test(obs=a, exp=b, two.tailed=FALSE) 39 40# compare above result with ecdf(), in which we compute an empirical 41f=ecdf(b) 42print(1-f(a)) # analogous to a one-tailed test as above 43}