Skip to content

Commit fd5b105

Browse files
20230207 - attenuation and disattenuation of correlation due to measurement error
1 parent bf84d28 commit fd5b105

7 files changed

Lines changed: 163 additions & 3 deletions

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: petersenlab
22
Type: Package
33
Title: Package of R Functions for the Petersen Lab
4-
Version: 0.1.2-9013
4+
Version: 0.1.2-9014
55
Authors@R: person("Isaac T.", "Petersen",
66
email = "isaac-t-petersen@uiowa.edu",
77
role = c("aut", "cre"),

NAMESPACE

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export(accuracyAtCutoff)
77
export(accuracyAtEachCutoff)
88
export(accuracyOverall)
99
export(addText)
10+
export(attenuationCorrelation)
1011
export(columnBindFill)
1112
export(complement)
1213
export(convert.magic)
@@ -17,6 +18,7 @@ export(convertToSeconds)
1718
export(cor.table)
1819
export(crossTimeCorrelation)
1920
export(crossTimeCorrelationDF)
21+
export(disattenuationCorrelation)
2022
export(discriminationToFactorLoading)
2123
export(dropColsWithAllNA)
2224
export(dropRowsWithAllNA)

R/attenuationCorrelation.R

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#' @title
2+
#' Attenuation of True Correlation Due to Measurement Error.
3+
#'
4+
#' @description
5+
#' Estimate the observed association between the predictor and criterion after
6+
#' accounting for the degree to which a true correlation is attenuated due to
7+
#' measurement error.
8+
#'
9+
#' @details
10+
#' Estimate the association that would be observed between the predictor and
11+
#' criterion after accounting for the degree to which a true correlation is
12+
#' attenuated due to random measurement error (unreliability).
13+
#'
14+
#' @param trueAssociation Magnitude of true association (\emph{r} value).
15+
#' @param reliabilityOfPredictor Reliability of predictor (from 0 to 1).
16+
#' @param reliabilityOfCriterion Reliability of criterion/outcome (from 0 to 1).
17+
#'
18+
#' @return
19+
#' Observed correlation between predictor and criterion.
20+
#'
21+
#' @family correlation
22+
#'
23+
#' @export
24+
#'
25+
#' @examples
26+
#' attenuationCorrelation(
27+
#' trueAssociation = .7,
28+
#' reliabilityOfPredictor = .9,
29+
#' reliabilityOfCriterion = .85)
30+
31+
attenuationCorrelation <- function(trueAssociation, reliabilityOfPredictor, reliabilityOfCriterion){
32+
observedAssociation <- trueAssociation * sqrt(reliabilityOfPredictor * reliabilityOfCriterion)
33+
34+
return(observedAssociation)
35+
}

R/disattenuationCorrelation.R

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#' @title
2+
#' Disattenuation of Observed Correlation Due to Measurement Error.
3+
#'
4+
#' @description
5+
#' Estimate the true association between the predictor and criterion after
6+
#' accounting for the degree to which a true correlation is attenuated due to
7+
#' measurement error.
8+
#'
9+
#' @details
10+
#' Estimate the true association between the predictor and criterion after
11+
#' accounting for the degree to which a true correlation is attenuated due to
12+
#' random measurement error (unreliability).
13+
#'
14+
#' @param observedAssociation Magnitude of observed association (\emph{r}
15+
#' value).
16+
#' @param reliabilityOfPredictor Reliability of predictor (from 0 to 1).
17+
#' @param reliabilityOfCriterion Reliability of criterion/outcome (from 0 to 1).
18+
#'
19+
#' @return
20+
#' True association between predictor and criterion.
21+
#'
22+
#' @family correlation
23+
#'
24+
#' @export
25+
#'
26+
#' @examples
27+
#' disattenuationCorrelation(
28+
#' observedAssociation = .7,
29+
#' reliabilityOfPredictor = .9,
30+
#' reliabilityOfCriterion = .85)
31+
32+
disattenuationCorrelation <- function(observedAssociation, reliabilityOfPredictor, reliabilityOfCriterion){
33+
trueAssociation <- observedAssociation / sqrt(reliabilityOfPredictor * reliabilityOfCriterion)
34+
35+
return(trueAssociation)
36+
}

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ remotes::install_github("DevPsyLab/petersenlab")
1414

1515
To obtain the citation for the `petersenlab` package, run `citation("petersenlab")`; the citation is:
1616

17-
Petersen, I. T. (2023). *petersenlab: Package of R functions for the Petersen Lab*. R package version 0.1.2-9013. https://github.com/DevPsyLab/petersenlab, https://doi.org/10.5281/zenodo.7602890
17+
Petersen, I. T. (2023). *petersenlab: Package of R functions for the Petersen Lab*. R package version 0.1.2-9014. https://github.com/DevPsyLab/petersenlab, https://doi.org/10.5281/zenodo.7602890
1818

1919
A `BibTeX` entry for `LaTeX` users is:
2020
```
@@ -23,7 +23,7 @@ A `BibTeX` entry for `LaTeX` users is:
2323
title = {{petersenlab}: Package of {R} functions for the {Petersen Lab}},
2424
url = {https://github.com/DevPsyLab/petersenlab},
2525
doi = {10.5281/zenodo.7602890},
26-
version = {0.1.2-9013},
26+
version = {0.1.2-9014},
2727
date = {2022-03-23}
2828
}
2929
```

man/attenuationCorrelation.Rd

Lines changed: 43 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/disattenuationCorrelation.Rd

Lines changed: 44 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)