An R
package for computing confidence curves, confidence intervals and
p-values for correlation coefficients corrected for attenuation due
to measurement
error. The
package implements the methods described in
Moss, 2019.
Run the following in R
to install the current CRAN release of the
package.
install.packages("attenuation")
Or use devtools
to install the development version.
# install.packages("devtools")
devtools::install_github("JonasMoss/attenuation")
Use cc
to calculate a confidence curve and plot
to plot it.
library("attenuation")
r = c(0.20, sqrt(0.45), sqrt(0.55))
N = c(100, 100, 100)
curve = cc(r, N)
plot(curve, level = 0.90)
Confidence sets can be calculated with ci
. NB: These sets are not
necessarily intervals. They can be either the disjoint union of two
intervals or empty.
ci(r, N)
#> [1] -0.1647174 0.9958587
To find the p-value for the null hypothesis of a specific rho, use the
p_value
function.
p_value(rho = 0, r, N)
#>
#> p-value for corrected correlation coefficients
#>
#> Arguments
#> Sample correlations: 0.2 0.671 0.742
#> Sample sizes: 100 100 100
#>
#> Hypothesis test
#> rho = 0
#> p-value: 0.263 method: corr
If you encounter a bug, have a feature request or need some help, open a Github issue. Create a pull requests to contribute. This project follows a Contributor Code of Conduct.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.