corXY {epibasix} | R Documentation |
Correlation of Two Vectors
Description
This function displays the simple correlation of two vectors of equal length, as well as providing confidence limits and hypothesis tests.
Usage
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 |
CIU |
The Upper bound of the constructed confidence interval for |
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
## Not run: Suppose we want to test whether two randomly generated normal vectors are uncorrelated
x <- rnorm(100);
y <- rnorm(100);
corXY(x,y);