Learn R Programming

wBoot (version 1.0.3)

boot.two.per: Percentile Bootstrap Independent Two-Samples Test and CI

Description

Obtains an independent-samples confidence interval and (optionally) performs an independent-samples hypothesis test for the difference between two population means, medians, proportions, or some user-defined function, using the percentile bootstrap method.

Usage

boot.two.per(x, y, parameter, stacked = TRUE, variable = NULL,
             null.hyp = NULL, alternative = c("two.sided", "less", "greater"),
             conf.level = 0.95, type = NULL, R = 9999)

Arguments

x
a numeric vector of observations of the variable (stacked case) or a numeric vector of data values representing the first of the two samples (unstacked case).
y
a vector of corresponding population identifiers (stacked case) or a numeric vector of data values representing the second of the two samples (unstacked case).
parameter
the parameter under consideration.
stacked
a logical value (default TRUE) indicating whether the data are stacked.
variable
an optional string that gives the name of the variable under consideration; ignored if stacked is TRUE.
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
R
the number of bootstrap replications; default is 9999.

Value

  • A list with class "boot.two" containing the following components:
  • Stackeda logical indicating whether the data are stacked (TRUE) or not (FALSE).
  • Boot.valuesthe point estimates for the difference between the parameter values obtained from the bootstrap.
  • Confidence.limitsthe confidence limit(s) for the confidence interval.
  • Parameterthe parameter under consideration.
  • Headerthe main title for the output.
  • Variablethe name of the variable under consideration or NULL.
  • Pop.1the first population.
  • Pop.2the second population.
  • n.1the sample size for the first population.
  • n.2the sample size for the second population.
  • Statisticthe name of the statistic.
  • Observed.1the observed point estimate for the parameter value of the first population.
  • Observed.2the observed point estimate for the parameter value of the second population.
  • Observedthe observed point estimate for the difference between the parameter values.
  • Replicationsthe number of bootstrap replications.
  • Meanthe mean of the bootstrap values.
  • SEthe standard deviation of the bootstrap values.
  • Biasthe difference between the mean of the bootstrap values and the observed value.
  • Percent.biasthe percentage bias: 100*|Bias/Observed|.
  • Nullthe null-hypothesis value or NULL.
  • Alternativethe alternative hypothesis or NULL.
  • P.valuethe P-value or a statement like P < 0.001 or NULL.
  • p.valuethe P-value or NULL.
  • Levelthe confidence level.
  • Typethe type of confidence interval.
  • Confidence.intervalthe 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.

concept

  • Bootstrap
  • Percentile bootstrap
  • Independent-samples inferences
  • Confidence interval
  • Hypothesis test
  • Inferences for two means
  • Inferences for two standard deviations
  • Inferences for two proportions

Details

For a proportion, the data must consist of 1s and 0s, with 1 corresponding to a success.

Examples

Run this code
# Driving distances, in yards, for independent samples of drives off a
# 2-3/4" wooden tee and off a 3" Stinger Competition golf tee.
data("tees")
str(tees)
attach(tees)
# Note that the data are unstacked.

# 99% confidence interval for the difference between the mean driving
# distances of the two types of tees. Name variable DISTANCE.
boot.two.per(REGULAR, STINGER, mean, stacked = FALSE, variable = "DISTANCE",
conf.level = 0.99)

# 95% (default) upper confidence bound for the difference between the mean
# driving distances of the two types of tees, a left-tailed test with null
# hypothesis -10 (i.e., the difference between the mean driving distances
# is -10 yards), and 99999 bootstrap replications. 
boot.two.per(REGULAR, STINGER, mean, stacked = FALSE, null.hyp = -10,
alternative = "less", R = 99999)

# 95% (default) confidence interval for the difference between the standard
# deviations of the driving distances, and a two-tailed test with null
# hypothesis 0 (i.e., the standard deviations are equal). Name variable DISTANCE.
boot.two.per(REGULAR, STINGER, sd, stacked = FALSE, variable = "DISTANCE", null.hyp = 0) 

detach(tees)  # clean up

Run the code above in your browser using DataLab