Description Usage Arguments Details Value Warning Author(s) Examples
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.
1 2 3 |
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 is "greater". |
R |
the number of bootstrap replications; default is 9999. |
For a proportion, the data must consist of 1s and 0s, with 1 corresponding to a success.
A list with class "boot.two" containing the following components:
Stacked |
a logical indicating whether the data are stacked (TRUE) or not (FALSE). |
Boot.values |
the point estimates for the difference between the parameter values obtained from the bootstrap. |
Confidence.limits |
the confidence limit(s) for the confidence interval. |
Parameter |
the parameter under consideration. |
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.1 |
the sample size for the first population. |
n.2 |
the sample size for the second population. |
Statistic |
the name of the statistic. |
Observed.1 |
the observed point estimate for the parameter value of the first population. |
Observed.2 |
the observed point estimate for the parameter value of the second population. |
Observed |
the observed point estimate for the difference between the parameter values. |
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. |
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.
Neil A. Weiss
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # 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
|
Loading required package: boot
Loading required package: simpleboot
Simple Bootstrap Routines (1.1-3 2008-04-30)
'data.frame': 30 obs. of 2 variables:
$ REGULAR: int 227 225 227 225 225 229 223 227 226 230 ...
$ STINGER: int 244 246 239 237 241 240 240 237 242 246 ...
RESULTS OF PERCENTILE BOOTSTRAP FOR DIFF.MEAN
SUMMARY Variable Pop.1 Pop.2 n.1 n.2 Statistic Observed
STATISTICS DISTANCE REGULAR STINGER 30 30 diff.mean -13.73333
BOOTSTRAP Replications Mean SE Bias Percent.bias
SUMMARY 9999 -13.73173 0.6238985 0.0016 0.0117
CONFIDENCE Level Type Confidence.interval
INTERVAL 99% two-sided (-15.3, -12.1)
RESULTS OF PERCENTILE BOOTSTRAP FOR DIFF.MEAN
SUMMARY Pop.1 Pop.2 n.1 n.2 Statistic Observed
STATISTICS REGULAR STINGER 30 30 diff.mean -13.73333
BOOTSTRAP Replications Mean SE Bias Percent.bias
SUMMARY 99999 -13.73347 0.6297516 -0.00014 0.00102
HYPOTHESIS Null Alternative P.value
TEST -10 less-than P < 0.001
CONFIDENCE Level Type Confidence.interval
INTERVAL 95% upper-bound -12.7 (UCB)
RESULTS OF PERCENTILE BOOTSTRAP FOR DIFF.SD
SUMMARY Variable Pop.1 Pop.2 n.1 n.2 Statistic Observed
STATISTICS DISTANCE REGULAR STINGER 30 30 diff.sd -0.6384737
BOOTSTRAP Replications Mean SE Bias Percent.bias
SUMMARY 9999 -0.63177 0.356673 0.0067 1.05
HYPOTHESIS Null Alternative P.value
TEST 0 not-equal 0.0809
CONFIDENCE Level Type Confidence.interval
INTERVAL 95% two-sided (-1.316, 0.08202)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.