Learn R Programming

miscor (version 0.1-0)

conf.cor: Product-moment correlation coefficient with confidence interval

Description

This function computes the product-moment correlation coefficient with two-sided or one-sided confidence interval using Fisher's z tranformation.

Usage

conf.cor(x = NULL, y = NULL, r = NULL, n = NULL, alternative = c("two.sided", "less", "greater"), conf.level = 0.95, digits = 3, output = TRUE)

Arguments

x
a numeric vector.
y
a numeric vector.
r
alternative specification, product-moment correlation coefficient.
n
alternative specification, number of observations.
alternative
a character string describing the alternative hypothesis, must be one of "two.sided" (default), "greater" or "less".
conf.level
confidence level of the interval.
digits
integer indicating the number of decimal places to be displayed.
output
logical; if TRUE, output is shown.

Value

Returns an object of class conf.cor with following entries:
call
function call
dat
data.frame with x and y (if available)
spec
specification of function arguments
res
list with results, i.e., r (correlation coefficient), n (sample size), lower (lower limit of CI), upper (upper limit of CI)

References

Rasch, D., Kubinger, K. D., & Yanagida, T. (2011). Statistics in psychology - Using R and SPSS. New York: John Wiley & Sons.

Kubinger, K. D., Rasch, D., & Simeckova, M. (2007). Testing a correlation coefficient's significance: Using H0: 0 $< \rho \le \lambda$ is preferable to H0: $\rho = $0. Psychology Science, 49, 74-87.

See Also

test.cor, seqtest.cor, comptest.cor

Examples

Run this code
#--------------------------------------
# Two-sided 95% Confidence Interval
# r = 0.55, n = 120

conf.cor(r = 0.55, n = 120)

#--------------------------------------
# One-sided 99% Confidence Interval

# Generate random data
dat <- sim.cor(100, rho = 0.4)

conf.cor(dat$x, dat$y, conf.level = 0.99, alternative = "less")

Run the code above in your browser using DataLab