File: methods-stats.Rd

package info (click to toggle)
r-cran-timeseries 4041.111-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,704 kB
  • sloc: makefile: 14
file content (86 lines) | stat: -rw-r--r-- 2,248 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
\name{timeSeries-method-stats}
\docType{methods}

\alias{sd-methods}
\alias{var-methods}
\alias{cov-methods}
\alias{cor-methods}

%\alias{dcauchy-methods}
%\alias{dnorm-methods}
%\alias{dt-methods}

%\alias{sd,timeSeries-method}
%\alias{var,timeSeries-method}
%\alias{cov,timeSeries-method}
%\alias{cor,timeSeries-method}
%\alias{dcauchy,timeSeries-method}
%\alias{dnorm,timeSeries-method}
%\alias{dt,timeSeries-method}


\title{Base R functions applied to 'timeSeries' objects}

\description{

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

}

%% 2023-05-29: these S4 methods don't exist! (and the functions are not generic!)
%\usage{
%\S4method{cov}{timeSeries}(x, y = NULL, use = "all.obs", 
%    method = c("pearson", "kendall", "spearman"))
%    
%\S4method{cor}{timeSeries}(x, y = NULL, use = "all.obs", 
%    method = c("pearson", "kendall", "spearman"))
%}
%
%\arguments{
%  \item{x}{
%    an univariate object of class \code{timeSeries}.
%  }
%  \item{y}{
%    \code{NULL} (default) or a \code{timeSeries} object with compatible
%    dimensions to \code{x}. The default is equivalent to \code{y = x}
%    (but more efficient).
%  }  
%  \item{use}{
%    an optional character string giving a method for computing
%    covariances in the presence of missing values. This must be (an
%    abbreviation of) one of the strings \code{"all.obs"},
%    \code{"complete.obs"} or \code{"pairwise.complete.obs"}.
%  }
%  \item{method}{ 
%    a character string indicating which correlation coefficient (or 
%    covariance) is to be computed. One of \code{"pearson"} (default), 
%    \code{"kendall"}, or \code{"spearman"}. Can be abbreviated.
%  }
%}
%
%\value{
%  covariance or correlation matrix
%}

\seealso{
  \code{\link{colStats}},
  \code{\link{colVars}}, and other \code{colXXX} functions
}
\examples{
## 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)   
}

\keyword{methods}
\keyword{chron}