File: assets-arrange.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 (113 lines) | stat: -rw-r--r-- 2,512 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
\name{assets-arrange}


\alias{assetsArrange}
\alias{pcaArrange}
\alias{hclustArrange}
\alias{abcArrange}
\alias{orderArrange}
\alias{sampleArrange}
\alias{statsArrange}

\title{Rearranging Assets Columnwise}


\description{
  
    Allows to rearrange a set of assets columnwise.
    
}
    

\usage{
assetsArrange(x, method = c("pca", "hclust", "abc"), ...)

pcaArrange(x, robust = FALSE, ...)
hclustArrange(x, method = c("euclidean", "complete"), ...)
abcArrange(x, ...)
orderArrange(x, ...)
sampleArrange(x, ...)
statsArrange(x, FUN = colMeans, ...)
}


\arguments{
  
    \item{x}{
        any rectangular time series object which can be converted by the 
        function \code{as.matrix()} into a matrix object, e.g. like an 
        object of class \code{timeSeries}, \code{data.frame}, or \code{mts}. 
        }   
    \item{method}{
        a character string, which method should be applied to reaarnage
        the assests? 
        Either 
        \code{"pca"} which arranges the columns by an eigenvalue decomposition,
        \code{"hclust"} which arrangtes the columns by hierarchical clustering,
        \code{"abc"} which arrangtes the columns alphabetically,
        \code{"order"} which arrangtes the columns by the order function,
        \code{"sample"} which arranges the columns randomly, or
        \code{"stats"} which arranges by an statistical strategy.
        }   
    \item{robust}{
        a logical flag. Should robust statistics applied?
    }
    \item{FUN}{
        function anme of the statistical function to be applied.
    }
    \item{\dots}{
        optional arguments to be passed.
        }
        
}


\value{
  
    a character vector with the rearranged assets names.
    
}


\author{

    Diethelm Wuertz for the Rmetrics port.
    
}


\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:3]
   head(LPP)
    
## assetsArrange -
   # Arrange Assets Columns:
   assetsArrange(x=LPP, "pca")
   assetsArrange(x=LPP, "hclust")
   assetsArrange(x=LPP, "abc")
   
## Alternative Usage -
   pcaArrange(x=LPP, robust=FALSE)
   pcaArrange(x=LPP, robust=TRUE)
   hclustArrange(x=LPP, method = c("euclidean", "complete"))
   abcArrange(x=LPP)
   orderArrange(x=LPP)
   sampleArrange(x=LPP)
   statsArrange(x=LPP, FUN=colMeans)
}


\keyword{models}