Package 'attenuation'

Title: Correcting for Attenuation Due to Measurement Error
Description: Confidence curves, confidence intervals and p-values for correlation coefficients corrected for attenuation due to measurement error. Implements the methods described in Moss (2019, <arxiv:1911.01576>).
Authors: Jonas Moss [aut, cre]
Maintainer: Jonas Moss <[email protected]>
License: MIT + file LICENSE
Version: 1.0.0
Built: 2025-02-09 02:58:43 UTC
Source: https://github.com/jonasmoss/attenuation

Help Index


Confidence curves for attenuated correlation coefficients.

Description

Confidence curves for attenuated correlation coefficients.

Usage

cc(r, N, lower = -1, upper = 1, by = 0.001, method = "corr",
  k = NULL)

Arguments

r

Numeric vector of three elements in [-1,1]. r[1] is the correlation between the noisy measures X' and Y', r[2] is the correlation between the noisy X' and the true X, while r[3] is the correlation between the noisy Y' and the true Y.

N

Numeric vector of three positive integers. N[i] is the sample size for r[i].

lower

Lower bound for the curve. Defaults to -1.

upper

Upper bound for the curve. Defaults to 1.

by

Increment of the sequence from lower to upper.

method

The type of confidence curve. Can be "corr", "cronbach", "HS" or "free". See the details of p_value.

k

Numeric vector of two positive integers. k[i] is the number of testlets for the for r[i+1]. Only needed for method "cronbach".

Value

An object of class ccaf.

Examples

r = c(0.20, sqrt(0.45), sqrt(0.55))
    N = c(100, 100, 100)
    plot(cc(r, N))

Calculate a confidence interval for an attenuated correlation coefficient.

Description

Calculate a confidence interval for an attenuated correlation coefficient.

Usage

ci(r, N, level = 0.95, method = "corr", k = NULL)

Arguments

r

Numeric vector of three elements in [-1,1]. r[1] is the correlation between the noisy measures X' and Y', r[2] is the correlation between the noisy X' and the true X, while r[3] is the correlation between the noisy Y' and the true Y.

N

Numeric vector of three positive integers. N[i] is the sample size for r[i].

level

Numeric in [0, 1]. Confidence level of the interval. Defaults to 0.95.

method

The type of confidence curve. Can be "corr", "cronbach", "HS" or "free". See the details of p_value.

k

Numeric vector of two positive integers. k[i] is the number of testlets for the for r[i+1]. Only needed for method "cronbach".

Value

Numeric in [0, 1]. The p-value under null-hypothesis rho.

Examples

r = c(0.20, sqrt(0.45), sqrt(0.55))
    N = c(100, 100, 100)
    ci(r, N) # Calculates 95% confidence set for rho.

Add a plot a confidence curve of attenuated correlation coefficients.

Description

Add a plot a confidence curve of attenuated correlation coefficients.

Usage

## S3 method for class 'ccaf'
lines(x, type = "l", col = "red3", lwd = 2, ...)

Arguments

x

An object of class ccaf. The confidence curve to plot.

type

The type of plot.

col

The color of the curve.

lwd

The thickness of the curve.

...

Passed to lines.

Value

An invisible copy of x.


Calculate the p-value for an attenuated correlation coefficient.

Description

This function calculates four types of p-values for correlations coefficients corrected for attenuation, chosen in "method". The different p-values are described in Moss (2019). "corr" is the correlation based p-value, "cronbach" is the Cronbach alpha based p-value, "HS" is the Hunter-Schmidt p-value, while "free" is the correlation based p-value without positive constraints.

Usage

p_value(rho, r, N, method = "corr", k = NULL)

Arguments

rho

Numeric vector in [-1,1]. The correlation under the null hypothesis.

r

Numeric vector of three elements in [-1,1]. r[1] is the correlation between the noisy measures X' and Y', r[2] is the correlation between the noisy X' and the true X, while r[3] is the correlation between the noisy Y' and the true Y. They are the square root of the reliabilities. Must be positive method to "corr" and "cronbach".

N

Numeric vector of three positive integers. N[i] is the sample size for r[i].

method

The type of p-value. Can be "corr", "cronbach", "HS" or "free". See the details.

k

Numeric vector of two positive integers. k[i] is the number of testlets for the for r[i+1]. Only needed for method "cronbach".

Value

Numeric in [0, 1]. The p-value under the null-hypothesis that the true correlation is rho.

Examples

r = c(0.20, sqrt(0.45), sqrt(0.55))
    N = c(100, 100, 100)
    p_value(rho = 0, r, N) # Tests rho = 0.

Plot a confidence curve of attenuated correlation coefficients.

Description

Plot a confidence curve of attenuated correlation coefficients.

Usage

## S3 method for class 'ccaf'
plot(x, y, level = 0.95, ...)

Arguments

x

An object of class ccaf. The confidence curve to plot.

y

Ignored; supported for compatibility with the plot generic.

level

Level to highlight. Defaults to 0.95. If NULL, highlights no level.

...

Passed to plot.

Value

An invisible copy of x.


Print method for ccaf

Description

Print method for ccaf

Usage

## S3 method for class 'ccaf'
print(x, digits = 3, ...)

Arguments

x

Object of class ccaf.

digits

Passed to signif.

...

Ignored.

Value

Invisible copy of x.