Learn R Programming

FertBoot (version 0.5.0)

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

Description

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

Usage

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

Run this code
# NOT RUN {
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

# }

Run the code above in your browser using DataLab