Learn R Programming

timeSeries (version 4041.111)

timeSeries-method-stats: Base R functions applied to 'timeSeries' objects

Description

Many base R statistical functions work on (the data part of) timeSeries objects without the need for special methods, e.g., var, sd, cov, cor, probability densities, and others. This page gives some examples with such functions.

Arguments

See Also

colStats, colVars, and other colXXX functions

Examples

Run this code
## Load Microsoft Data Set - 
   data(MSFT)
   X = MSFT[, 1:4]
   X = 100 * returns(X)

## Compute Covariance Matrix - 
   cov(X[, "Open"], X[, "Close"])
   cov(X)

cor(X)   

Run the code above in your browser using DataLab