File: assets-distance.Rd

package info (click to toggle)
fassets 3011.83-2
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 428 kB
  • sloc: makefile: 1
file content (165 lines) | stat: -rw-r--r-- 3,650 bytes parent folder | download | duplicates (3)
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
\name{assets-distance}


\alias{assetsDist}

\alias{corDist}     
\alias{kendallDist}  
\alias{spearmanDist}    
\alias{mutinfoDist}            
\alias{euclideanDist}   
\alias{maximumDist}     
\alias{manhattanDist}   
\alias{canberraDist}    
\alias{binaryDist}      
\alias{minkowskiDist}         
\alias{braycurtisDist}  
\alias{mahalanobisDist} 
\alias{jaccardDist}     
\alias{sorensenDist}   


\title{Distance Measures}


\description{
  
    Allows to measure the distance or similarity between assets.
    
}
    

\usage{
assetsDist(x, method="cor", \dots)

corDist(x)  
kendallDist(x) 
spearmanDist(x) 
  
mutinfoDist(x, nbin=10)
         
euclideanDist(x)    
maximumDist(x)      
manhattanDist(x)  
canberraDist(x)   
binaryDist(x)      
minkowskiDist(x) 
         
braycurtisDist(x)   
mahalanobisDist(x) 
jaccardDist(x)     
sorensenDist(x) 
}


\arguments{
  
    \item{x}{
        any rectangular time series object which can be converted by the 
        function \code{dist()} into a distance object. 
        }
    \item{method}{
        a character string, the method from which to compute the
        distances. Allowed methods include \code{cor}, \code{kendall},
        \code{spearman}, \code{mutinfo}, \code{euclidean}, \code{maximum}, 
        \code{manhattan}, \code{canberra}, \code{binary}, \code{minkowski},
        \code{braycurtis}, \code{mahalanobis}, \code{jaccard}, 
        \code{difference}, or \code{sorensen}.
        }
    \item{nbin}{
        an integer value, the number of bins, by default 10.
        }  
    \item{\dots}{
        optional argument to be passed the distance function.
        }
        
}


\value{
  
    an object of class \code{dist}.
    
}


\details{

    \code{corDist}, \code{kendallDist}, and \code{spearmanDist} call the 
    base \code{cov} function from R.
    
    \code{mutinfoDist} calls the function \code{mutinfo} from the contributed
    R package \code{bioDist}.
    
    \code{euclideanDist}, \code{maximumDist}, \code{manhattanDist}, 
    \code{canberraDist}, \code{binaryDist}, and \code{minkowskiDist} 
    are functions build on top of R's base package.
    
    \code{braycurtisDist}, \code{mahalanobisDist}, \code{jaccardDist},  
    and \code{sorensenDist} call functions from
    the contributed R package \code{ecodist}.
    
}


\references{

Wuertz, D., Chalabi, Y., Chen W., Ellis A. (2009);
    \emph{Portfolio Optimization with R/Rmetrics}, 
    Rmetrics eBook, Rmetrics Association and Finance Online, Zurich.
    
}


\examples{  
## LPP -
   # Load Swiss Pension Fund Data:
   LPP <- LPP2005REC[, 1:6]
   head(LPP)

## Returns correlation distance measure
   corDist(LPP)  
   
## Returns kendalls correlation distance measure  
   kendallDist(LPP) 
   
## Returns spearmans correlation distance measure
   spearmanDist(LPP)          

## Return mutual information distance measure
   mutinfoDist(LPP)             

## Return Euclidean distance measure
   euclideanDist(LPP)
   
## Return maximum distance measure
   maximumDist(LPP)              

## Return Manhattan distance measure  
   manhattanDist(LPP)            

## Return Canberra distance measure
   canberraDist(LPP)             

## Return binary distance measure
   binaryDist(LPP)               

## Return Minkowsky distance measure
   minkowskiDist(LPP)            

## Return Bray Curtis distance measure
   braycurtisDist(LPP)           
   
## Return Mahalanobis distance measure
   # mahalanobisDist(LPP)          
   
## Return Jaccard distance mesaure
   jaccardDist(LPP)         
   
## Return Sorensen distance measure
   sorensenDist(LPP)               
}


\keyword{stats}