cor.origin {PHYLOGR}R Documentation

Correlation Through the Origin

Description

Return the correlation through the origin of two vectors. Generally used for indepdendent contrasts

Usage

cor.origin(x, y)

Arguments

x A vector
y A vector (of same size as x)

Value

The correlation of x and y, from a model without intercept (i.e., forcing the line through the origin).

Note

This is a very simple function, provided for convenience. You can obtain the p-value, if you wish, with the usual formula for the t-statistic: 2*(1 - pt(sqrt(df) * rho / sqrt(1 - rho^2), df)) where rho is the correlation through the origin and df are the appropriate degrees of freedom —generally N-1.

Author(s)

R. Diaz-Uriarte and T. Garland, Jr.

References

Diaz-Uriarte, R., and Garland, T., Jr., in prep. PHYLOGR: an R package for the analysis of comparative data via Monte Carlo simulations and generalized least squares approaches.

Examples

 x <- rnorm(100)
 y <- rnorm(100)
 rho <- cor.origin(x,y)
 rho # the correlation
 2 * (1 - pt(sqrt(99) * rho / sqrt(1 - rho^2), 99))  # the p-value
 

[Package PHYLOGR version 1.0.6 Index]