| Title: | Stochastic Approximation Confidence Interval for Correlation |
|---|---|
| Description: | Implements stochastic approximation method for constructing nonparametric confidence intervals for correlation coefficient, based on Xiong & Xu (2016). |
| Authors: | Pengyu Chen Group1 [aut, cre] |
| Maintainer: | Pengyu Chen Group1 <[email protected]> |
| License: | GPL (>= 3) |
| Version: | 0.1.0 |
| Built: | 2026-05-30 07:21:37 UTC |
| Source: | https://github.com/cran/saCI |
Computes confidence interval for the correlation of two populations using bootstrap BCa (bias-corrected and accelerated) method.
boot_corrCI(x, y, conf.level = 0.95, R = 999)boot_corrCI(x, y, conf.level = 0.95, R = 999)
x |
Numeric vector of first variable (must have same length as y) |
y |
Numeric vector of second variable (must have same length as x) |
conf.level |
Confidence level for the interval (default 0.95) |
R |
Number of bootstrap replicates (default 999) |
This function implements the BCa (bias-corrected and accelerated) bootstrap method for constructing confidence intervals for Pearson's correlation coefficient. The BCa method adjusts for both bias and skewness in the bootstrap distribution.
The data is standardized in the same way as corrCI_sa for consistency in comparison studies.
An S3 object of class "corrCI_boot" containing:
lower |
Lower bound of the confidence interval |
upper |
Upper bound of the confidence interval |
estimate |
Point estimate of correlation coefficient |
conf.level |
The confidence level |
method |
Description of the method |
Efron, B. (1987). Better Bootstrap Confidence Intervals. Journal of the American Statistical Association, 82(398), 171-185.
set.seed(42) x <- rnorm(30) y <- x + rnorm(30, sd = 0.5) result <- boot_corrCI(x, y) print(result)set.seed(42) x <- rnorm(30) y <- x + rnorm(30, sd = 0.5) result <- boot_corrCI(x, y) print(result)
Computes confidence interval for the correlation of two populations using stochastic approximation via resampling method (Garthwaite, 1996).
corrCI_sa(x, y, conf.level = 0.95)corrCI_sa(x, y, conf.level = 0.95)
x |
Numeric vector of first variable (must have same length as y) |
y |
Numeric vector of second variable (must have same length as x) |
conf.level |
Confidence level for the interval (default 0.95) |
This function implements the stochastic approximation algorithm for constructing nonparametric confidence intervals for Pearson's correlation coefficient, based on Garthwaite (1996). The algorithm uses recursive resampling to find the quantiles of the sampling distribution.
An S3 object of class "corrCI_sa" containing:
lower |
Lower bound of the confidence interval |
upper |
Upper bound of the confidence interval |
estimate |
Point estimate of correlation coefficient |
conf.level |
The confidence level |
method |
Description of the method |
iterations |
List with components L (iterations for lower bound) and U (iterations for upper bound) |
Garthwaite, P. H. (1996). Confidence interval formation via stochastic approximation. Statistics and Computing, 6(3), 235-241.
set.seed(42) x <- rnorm(30) y <- x + rnorm(30, sd = 0.5) result <- corrCI_sa(x, y) print(result)set.seed(42) x <- rnorm(30) y <- x + rnorm(30, sd = 0.5) result <- corrCI_sa(x, y) print(result)
Prints the results of a bootstrap correlation confidence interval analysis.
## S3 method for class 'corrCI_boot' print(x, ...)## S3 method for class 'corrCI_boot' print(x, ...)
x |
An object of class "corrCI_boot" |
... |
Additional arguments passed to print |
Prints the confidence interval, estimate, and method information.
Prints the results of a correlation confidence interval analysis.
## S3 method for class 'corrCI_sa' print(x, ...)## S3 method for class 'corrCI_sa' print(x, ...)
x |
An object of class "corrCI_sa" |
... |
Additional arguments passed to print |
Prints the confidence interval, estimate, and method information.
Run the saCI Shiny Application
runShinyApp()runShinyApp()
Starts the Shiny app