Description Usage Arguments Details Value Warning Author(s) Examples
View source: R/boot.slope.per.R
Obtains a confidence interval and (optionally) performs a hypothesis test for the slope of a population regression line in simple linear regression, using the percentile bootstrap method.
1 2 3 | boot.slope.per(x, y, null.hyp = NULL,
alternative = c("two.sided", "less", "greater"),
conf.level = 0.95, type = NULL, R = 9999)
|
x |
a (non-empty) numeric vector of predictor-variable data values. |
y |
the corresponding numeric vector of response-variable data values. |
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 |
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. |
If null.hyp = 0
and alternative = "two.sided"
, then the
hypothesis test is equivalent to testing whether the predictor variable
is useful for making predictions.
A list with class "boot.regcor" containing the following components:
Boot.values |
the point estimates for the slope obtained from the bootstrap. |
Confidence.limits |
the confidence limit(s) for the confidence interval. |
Header |
the main title for the output. |
Variable.1 |
the predictor variable. |
Variable.2 |
the response variable. |
n |
the sample size. |
Statistic |
the name of the statistic, here slope. |
Observed |
the observed point estimate for the slope. |
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. |
cor.ana |
a logical; always FALSE for this function. |
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 | # Lot size, house size, and value for a sample of homes in a particular area.
data("homes")
str(homes)
attach(homes)
# 95% (default) lower confidence bound for the slope of the population regression
# line relating lot size and value, a right-tailed test with null hypothesis 0,
# and 999 bootstrap replications.
boot.slope.per(LOT.SIZE, VALUE, null.hyp = 0, alternative = "greater", R = 999)
# See the preceding warning!
# 90% two-sided confidence interval for the slope of the population regression line
# relating house size and value, a right-tailed test with null hypothesis 0, and
# 999 bootstrap replications.
boot.slope.per(HOUSE.SIZE, VALUE, null.hyp = 0, alternative = "greater",
conf.level = 0.90, type = "two-sided", R = 999)
detach(homes) # clean up
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.