Percentile Bootstrap Paired-Samples Test and CI for Two Means

Share:

Description

Obtains a paired-samples confidence interval and (optionally) performs a paired-samples hypothesis test for the difference between two population means, using the percentile bootstrap method.

Usage

1
2
3
boot.paired.per(x, y, variable = NULL, null.hyp = NULL,
                alternative = c("two.sided", "less", "greater"),
                conf.level = 0.95, type = NULL, R = 9999)

Arguments

x

a (non-empty) numeric vector of data values.

y

a (non-empty) numeric vector of data values.

variable

an optional character string that gives the name of the variable under consideration.

null.hyp

the null-hypothesis value; if omitted, no hypothesis test is performed.

alternative

a character string specifying the alternative hypothesis; must be one of "two.sided" (default), "greater", or "less".

conf.level

the confidence level (between 0 and 1); default is 0.95.

type

a character string specifying the type of CI; if user-supplied, must be one of "two-sided", "upper-bound", or "lower-bound"; defaults to "two-sided" if alternative is "two.sided", "upper-bound" if alternative is "less", and "lower-bound" if alternative is "greater".

R

the number of bootstrap replications; default is 9999.

Details

Note that x and y must have the same length, as together they represent the paired data. Also note, for instance, that alternative = "greater" is the alternative that x variable has a larger mean than y variable.

Value

A list with class "boot.paired" containing the following components:

Boot.values

the point estimates for the differences between the means obtained from the bootstrap.

Confidence.limits

the confidence limit(s) for the confidence interval.

Header

the main title for the output.

Variable

the name of the variable under consideration or NULL

Pop.1

the first population.

Pop.2

the second population.

n

the sample size.

Statistic

the name of the statistic, here diff.mean.

Observed

the observed point estimate for the difference between the means.

Replications

the number of bootstrap replications.

Mean

the mean of the bootstrap values.

SE

the standard deviation of the bootstrap values.

Bias

the difference between the mean of the bootstrap values and the observed value.

Percent.bias

the percentage bias: 100*|Bias/Observed|.

Null

the null-hypothesis value or NULL.

Alternative

the alternative hypothesis or NULL.

P.value

the P-value or a statement like P < 0.001 or NULL.

p.value

the P-value or NULL.

Level

the confidence level.

Type

the type of confidence interval.

Confidence.interval

the confidence interval.

Warning

This routine should be used only when bias is small and the sampling distribution is roughly symmetric, as indicated by the output of the bootstrap. Otherwise, use the BCa version.

Author(s)

Neil A. Weiss

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# The number of inappropriate words out of 10 that were identified in the
# Times New Roman (TNR) and Gigi fonts by each of 25 participants.
data("fonts")
str(fonts)
attach(fonts)

# 90% confidence interval for the difference between the mean number of
# inappropriate words out of 10 identified for the TNR and Gigi fonts.
boot.paired.per(TNR, GIGI, conf.level = 0.90)

# A right-tailed test with null hypothesis 2, and a 95% (default) lower
# confidence bound for the difference between the mean number of
# inappropriate words out of 10 identified for the TNR and Gigi fonts. 
boot.paired.per(TNR, GIGI, null.hyp = 2, alternative = "greater")
# Not significant at the 5% level.

# A right-tailed test with null hypothesis 1, and a 95% (default) lower
# confidence bound for the difference between the mean number of
# inappropriate words out of 10 identified for the TNR and Gigi fonts.
boot.paired.per(TNR, GIGI, null.hyp = 1, alternative = "greater")
# Significant at the 5% level.

detach(fonts)   # clean up

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.