boot.cor.per: Percentile Bootstrap Correlation Test and CI

Description Usage Arguments Value Warning Author(s) Examples

View source: R/boot.cor.per.R

Description

Obtains a confidence interval and (optionally) performs a hypothesis test for the Pearson correlation, using the percentile bootstrap method.

Usage

1
2
3
boot.cor.per(x, y, 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.

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.

Value

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

Boot.values

the point estimates (correlations) obtained from the bootstrap.

Confidence.limits

the confidence limit(s) for the confidence interval.

Header

the main title for the output.

Variable.1

the first variable.

Variable.2

the second variable.

n

the sample size.

Statistic

the name of the statistic, here correlation.

Observed

the observed point estimate (correlation).

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 TRUE for this function.

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
# NOTE: See the preceding warning!

# Lot size, house size, and value for a sample of homes in a particular area.
data("homes")
str(homes)
attach(homes)

# 95% (default) confidence interval for the correlation between lot size and value.
boot.cor.per(LOT.SIZE, VALUE)

# 95% (default) lower confidence bound for the correlation between house size
# and value, and a right-tailed test with null hypothesis 0.5.
boot.cor.per(HOUSE.SIZE, VALUE, null.hyp = 0.5, alternative = "greater")

# 90% two-sided confidence interval for the correlation between house size and value,
# a right-tailed test with null hypothesis 0.5, and 999 bootstrap replications.
boot.cor.per(HOUSE.SIZE, VALUE, null.hyp = 0.5, alternative = "greater",
conf.level = 0.90, type = "two-sided", R = 999)

detach(homes) # clean up

Example output

Loading required package: boot
Loading required package: simpleboot
Simple Bootstrap Routines (1.1-3 2008-04-30)
'data.frame':	44 obs. of  3 variables:
 $ HOUSE.SIZE: num  2311 2968 3773 1934 5466 ...
 $ LOT.SIZE  : num  2.37 2.09 2.21 2.21 2.1 2.06 2.03 2.44 2.14 2.63 ...
 $ VALUE     : num  396 355 586 254 646 278 279 748 546 338 ...


 RESULTS OF PERCENTILE BOOTSTRAP FOR CORRELATION 

    SUMMARY Variable.1 Variable.2  n   Statistic  Observed
 STATISTICS   LOT.SIZE      VALUE 44 correlation 0.1704518

 BOOTSTRAP Replications      Mean        SE    Bias Percent.bias
   SUMMARY         9999 0.1767758 0.1386192 0.00632         3.71

 CONFIDENCE Level      Type Confidence.interval
   INTERVAL   95% two-sided  (-0.08243, 0.4531)




 RESULTS OF PERCENTILE BOOTSTRAP FOR CORRELATION 

    SUMMARY Variable.1 Variable.2  n   Statistic  Observed
 STATISTICS HOUSE.SIZE      VALUE 44 correlation 0.6876834

 BOOTSTRAP Replications      Mean         SE    Bias Percent.bias
   SUMMARY         9999 0.6896251 0.07717593 0.00194        0.282

 HYPOTHESIS Null  Alternative P.value
       TEST  0.5 greater-than  0.0122

 CONFIDENCE Level        Type Confidence.interval
   INTERVAL   95% lower-bound         0.554 (LCB)




 RESULTS OF PERCENTILE BOOTSTRAP FOR CORRELATION 

    SUMMARY Variable.1 Variable.2  n   Statistic  Observed
 STATISTICS HOUSE.SIZE      VALUE 44 correlation 0.6876834

 BOOTSTRAP Replications      Mean         SE    Bias Percent.bias
   SUMMARY          999 0.6890966 0.07648732 0.00141        0.205

 HYPOTHESIS Null  Alternative P.value
       TEST  0.5 greater-than  0.0115

 CONFIDENCE Level      Type Confidence.interval
   INTERVAL   90% two-sided    (0.5514, 0.8077)

wBoot documentation built on May 1, 2019, 7:31 p.m.