cor_ech: Anticipate the sample size that will be needed to detect a...

View source: R/sample_bootstrap.R

cor_echR Documentation

Anticipate the sample size that will be needed to detect a correlation (if there is one)

Description

Anticipate the sample size that will be needed to detect a correlation (if there is one)

Usage

cor_ech(x, y, iter = 100)

Arguments

x

: The values of my x variable

y

: The values of my x variable

iter

: Number of iterations of bootstrapping

Value

: When I do a regression/correlation, I may have an insignificant p-value due to the fact that I don't have enough values. This function exercises a bootstrap that will suggest how many values it would take to have a significant correlation (if any).

Examples

x <- c(1,5,6,9,10)
y <- c(0,4.5,10,9,30)
plot(x,y,cex=2,pch=16)
cor.test(x,y)$p.value # No significant
cor_ech(x,y)

Antoine-Masse/KefiR documentation built on Feb. 22, 2024, 5:54 a.m.