calculateCIs: Calculate Confidence Intervals for Correlation Coefficients

View source: R/estimateCIs.R

calculateCIsR Documentation

Calculate Confidence Intervals for Correlation Coefficients

Description

This function calculates confidence intervals for correlation coefficients using different methods.

Usage

calculateCIs(
  tbl,
  rho_var,
  se_var,
  doubleentered = FALSE,
  method = "raykov",
  adjust_base = 1,
  design_effect_m = NULL,
  design_effect_rho = NULL,
  design_effect_m_col = NULL,
  design_effect_rho_col = NULL,
  conf_level = 0.95
)

Arguments

tbl

A data frame or tibble containing the correlation coefficient and standard error variables.

rho_var

The name of the column in tbl that contains the correlation coefficients.

se_var

The name of the column in tbl that contains the standard errors.

doubleentered

Logical. If TRUE, the function assumes that the correlation coefficients are double-entered, which adjusts the standard errors accordingly. Default is FALSE.

method

The method to use for calculating the confidence intervals. Options are "raykov", "fisherz", "doubleenteredconserv", or "doubleentered".

adjust_base

A numeric value to adjust the standard errors. Default is 1.

design_effect_m

A numeric value for the design effect related to the mean. Default is NULL.

design_effect_rho

A numeric value for the design effect related to the correlation. Default is NULL.

design_effect_m_col

A character string specifying the column name for the design effect related to the mean. Default is NULL.

design_effect_rho_col

A character string specifying the column name for the design effect related to the correlation. Default is NULL.

conf_level

The confidence level for the intervals. Default is 0.95.

Value

A modified version of tbl with additional columns for the confidence intervals and related statistics. Everything uses adjusted standard errors, including confidence intervals, z-tests, and p-values.

Examples

tbl <- data.frame(rho = c(0.5, 0.7, 0.3), se = c(0.1, 0.2, 0.05))
calculateCIs(tbl, rho_var = "rho", se_var = "se", method = "raykov")


BGmisc documentation built on June 11, 2025, 1:07 a.m.