Learn R Programming

optimStrat (version 2.0)

covp: Covariance

Description

Compute the covariance between x and y.

Usage

covp(x, y)

Arguments

x

a numeric vector.

y

a numeric vector.

Value

An object with the covariance between x and y.

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

cov

Examples

Run this code
# NOT RUN {
x<- rnorm(100)
y<- rnorm(100)
covp(x, y)
cov(x, y)
# }

Run the code above in your browser using DataLab