cor.n | R Documentation |
Compute the sample size for a given correlation coefficient, alpha level,
and confidence interval width. Alternatively, solve for the coefficient,
interval width, or alpha level given fixed parameters. cor.ci
calculated the confidence interval for a fixed correlation coefficient
and sample size.
cor.n(
rho = NULL,
n = NULL,
width = NULL,
alpha = 0.05,
two.sided = TRUE,
method = c("bonett", "fieller"),
tol = .Machine$double.eps^0.25
)
cor.ci(rho, n, alpha = 0.05, two.sided = TRUE, method = c("bonett", "fieller"))
rho |
correlation coefficient |
n |
sample size |
width |
the width of the |
alpha |
type I error probability |
two.sided |
logical; if |
method |
the method used to calculate the standard deviation, one of
|
tol |
numerical tolerance used in root finding, the default providing (at least) four significant digits |
http://solarmuri.ssl.berkeley.edu/~schuck/public/manuscripts/Fieller1.pdf
https://stats.stackexchange.com/a/18904
## table 1, bonett (spearman) -- solving for n
args <- data.frame(
rho = 0.9,
width = rep(1:3, each = 2) / 10,
alpha = c(0.05, 0.01)
)
apply(args, 1L, function(x)
ceiling(cor.n(x['rho'], NULL, x['width'], x['alpha'])))
## table 1, bonett (spearman)
cor.ci(0.1, 290, 0.01)
ceiling(cor.n(0.1, NULL, 0.3, 0.01))
cor.ci(0.5, 111, 0.05)
ceiling(cor.n(0.5, NULL, 0.3, 0.05))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.