corXY: Correlation of Two Vectors

Description Usage Arguments Details Value Author(s) References Examples

View source: R/corXY.R

Description

This function displays the simple correlation of two vectors of equal length, as well as providing confidence limits and hypothesis tests.

Usage

1
corXY(X, Y, alpha=0.05, rho0 = 0, HA="not.equal", digits=3)

Arguments

X

A Vector of the same length as Y

Y

A Vector of the same length as X, This function requires the input of Vectors

alpha

The Type I error rate for Hypothesis Tests and Confidence Intervals

rho0

The Null Hypothesis for Hypothesis Tests

HA

The alternative hypothesis can be one of "less.than", "greater.than", or "not.equal"

digits

The number of digits to round results

Details

This function provides the required information, such as the Pearson correlation Hypothesis Tests and confidence intervals, while providing suitable detail in the and print statements for epidemiologists to understand the information at hand.

Value

rho

The Sample Pearson Correlation, as calculated in the cor function.

n

The sample size.

Test

The Test Statistic for the desired hypothesis test based on Fisher's Transformation.

p.Value

The p-value for the Hypothesis Test.

CIL

The lower bound of the constructed confidence interval for rho, again based on Fisher's Z Transformation.

CIU

The Upper bound of the constructed confidence interval for rho, again based on Fisher's Z Transformation.

alpha

The desired Type I Error Rate

rho0

The Null Hypothesis

HA

The supplied Alternative Hypothesis

Author(s)

Michael Rotondi, mrotondi@yorku.ca

References

Casella G and Berger RL. Statistical Inference (2nd Ed.) Duxbury: New York, 2002. Koepsell TD and Weiss NS. Epidemiologic Methods. Oxford University Press: New York, 2003.

Examples

1
2
3
4
## Not run: Suppose we want to test whether two randomly generated normal vectors are uncorrelated
x <- rnorm(100);
y <- rnorm(100);
corXY(x,y);

Example output

Correlation Summary
 
Sample Size: 100
Sample Correlation: 0.007
95% Confidence Limits for rho are (using Fisher's Z Transformation) : [-0.19, 0.203]

epibasix documentation built on May 2, 2019, 10:08 a.m.

Related to corXY in epibasix...