compare.two.sample: Two sample bootstrap test for comparing different in...

Description Usage Arguments Value Examples

View source: R/compare.two.sample.R

Description

Two sample bootstrap test for comparing different in sample1 and sample2, not necessary with same sample size

Usage

1
compare.two.sample(sample1, sample2, fun = mean, R = 1000)

Arguments

sample1

first sample

sample2

second sample

fun

statistic (univariate) to be compared (default: mean)

R

number of resamples (default: 1000)

Value

compare.two.sample return a list with two components, namely, p.value: two tailed p-value for the bootstrap test object: a "simpleboot" object allowing further analysis using other R packages, such as boot)

Examples

1
2
3
4
5
6
set.seed(1203)
# compare median of two expontential r.v.
compare.two.sample(rexp(100, rate=1), rexp(100, rate=2), fun=median, R=1e3)$p.value

f.Q1 <- function(x) quantile(x, probs=0.25)
compare.two.sample(rnorm(100, mean=0), rnorm(200, mean=0.5), fun=f.Q1, R=1e3)$p.value

FertBoot documentation built on Feb. 20, 2021, 1:06 a.m.