View source: R/sample_bootstrap.R
cor_ech | R Documentation |
Anticipate the sample size that will be needed to detect a correlation (if there is one)
cor_ech(x, y, iter = 100)
x |
: The values of my x variable |
y |
: The values of my x variable |
iter |
: Number of iterations of bootstrapping |
: 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).
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.