Learn R Programming

MOTE (version 1.2.2)

r_correl: r to Coefficient of Determination (R\(^2\)) from F

Description

This function displays the transformation from \(r\) to \(R^2\) to calculate the non-central confidence interval for \(R^2\) using the \(F\) distribution.

Usage

r_correl(r, n, a = 0.05)

r.correl(r, n, a = 0.05)

Value

r

correlation coefficient

rlow

lower level confidence interval for \(r\)

rhigh

upper level confidence interval for \(r\)

R2

coefficient of determination

R2low

lower level confidence interval of \(R^2\)

R2high

upper level confidence interval of \(R^2\)

se

standard error

n

sample size

dfm

degrees of freedom of mean

dfe

degrees of freedom of error

t

\(t\)-statistic

F

\(F\)-statistic

p

p-value

estimate

the \(r\) statistic and confidence interval in APA style for markdown printing

estimateR2

the \(R^2\) statistic and confidence interval in APA style for markdown printing

statistic

the \(t\)-statistic in APA style for markdown printing

Arguments

r

correlation coefficient

n

sample size

a

significance level

Details

The \(t\)-statistic is calculated by: $$t = \frac{r}{\sqrt{\frac{1 - r^2}{n - 2}}}$$

The \(F\)-statistic is the \(t\)-statistic squared: $$F = t^2$$

Learn more on our example page.

**Note on function and output names:** This effect size is now implemented with the snake_case function name `r_correl()` to follow modern R style guidelines. The original dotted version `r.correl()` is still available as a wrapper for backward compatibility, and both functions return the same list. The returned object includes both the original element names (e.g., `r`, `rlow`, `rhigh`, `R2`, `R2low`, `R2high`, `se`, `n`, `dfm`, `dfe`, `t`, `F`, `p`, `estimate`, `estimateR2`, `statistic`) and newer snake_case aliases (e.g., `r_value`, `r_lower_limit`, `r_upper_limit`, `r2_value`, `r2_lower_limit`, `r2_upper_limit`, `standard_error`, `sample_size`, `df_model`, `df_error`, `t_value`, `f_value`, `p_value`). New code should prefer `r_correl()` and the snake_case output names, but existing code using the older names will continue to work.

Examples

Run this code

# This example is derived from the mtcars dataset provided in R.

# What is the correlation between miles per gallon and car weight?

cor.test(mtcars$mpg, mtcars$wt)

r_correl(r = -0.8676594, n = 32, a = .05)

# Backwards-compatible dotted name (deprecated)
r.correl(r = -0.8676594, n = 32, a = .05)

Run the code above in your browser using DataLab