Learn R Programming

PHYLOGR (version 1.0.11)

cor.origin: 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).

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

Run this code
# NOT RUN {
 x <- rnorm(100)
 y <- rnorm(100)
 rho <- cor.origin(x,y)
 rho # the correlation
 2 * (1 - pt(sqrt(99) * abs(rho) / sqrt(1 - rho^2), 99))  # the p-value
 
# }

Run the code above in your browser using DataLab