Learn R Programming

optimStrat (version 2.4)

covp: Covariance

Description

Compute the covariance between x and y.

Usage

covp(x, y)

Value

An object with the covariance between x and y.

Arguments

x

a numeric vector.

y

a numeric vector.

Details

Compute the covariance between x and y using \(n\) (instead of \(n-1\) as in cov) in the denominator.

If the length of x and y are different, the elements of the shortest one will be recycled as necessary.

See Also

Examples

Run this code
x<- rnorm(100)
y<- rnorm(100)
covp(x, y)
cov(x, y)

Run the code above in your browser using DataLab