~ubuntu-branches/ubuntu/trusty/fportfolio/trusty

« back to all changes in this revision

Viewing changes to man/frontierPlot.Rd

  • Committer: Bazaar Package Importer
  • Author(s): Dirk Eddelbuettel
  • Date: 2008-12-04 11:36:54 UTC
  • mfrom: (1.1.6 upstream) (2.1.3 squeeze)
  • Revision ID: james.westby@ubuntu.com-20081204113654-gr832nfs44blp5ph
Tags: 280.74-1
* New upstream release
* Finally uploading as r-cran-rglpk is out of NEW after five weeks

* debian/control: Updated (Build-)Depends: and Suggests:

* debian/control: Set (Build-)Depends: to current R version
* debian/control: Set Standards-Version: to current version

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
\name{frontierPlot}
 
2
 
 
3
 
 
4
\alias{frontierPlot}
 
5
 
 
6
\alias{minvariancePoints}
 
7
\alias{cmlPoints}
 
8
\alias{cmlLines}
 
9
\alias{tangencyPoints}
 
10
\alias{tangencyLines}
 
11
\alias{equalWeightsPoints}
 
12
\alias{singleAssetPoints}
 
13
\alias{twoAssetsLines}
 
14
\alias{sharpeRatioLines}
 
15
 
 
16
\alias{monteCarloPoints}
 
17
 
 
18
 
 
19
\title{Efficient Frontier Plot}
 
20
 
 
21
 
 
22
\description{
 
23
 
 
24
    Plots the efficient frontier of an 
 
25
    optimized portfolio and allows to add
 
26
    points and lines from specif portfolios
 
27
    
 
28
    The functions are:
 
29
    
 
30
    \tabular{ll}{
 
31
    \code{frontierPlot} \tab Plots efficient frontier, \cr
 
32
    \code{minvariancePoints} \tab Adds minimum variance point, \cr
 
33
    \code{cmlPoints} \tab Adds market portfolio, \cr
 
34
    \code{cmlLines} \tab  Adds capital market Line, \cr
 
35
    \code{tangencyPoints} \tab Adds tangency portfolio point, \cr
 
36
    \code{tangencyLines} \tab Adds tangency line, \cr
 
37
    \code{equalWeightsPoints} \tab Adds point of equal weights portfolio, \cr
 
38
    \code{singleAssetPoints} \tab Adds points of single asset portfolios, \cr
 
39
    \code{twoAssetsLines} \tab Adds EF for all combinations of two assets, \cr
 
40
    \code{sharpeRatioLines} \tab Adds Sharpe ratio line, \cr
 
41
    \code{monteCarloPoints} \tab Adds randomly produced feasible portfolios. }
 
42
 
 
43
}
 
44
 
 
45
 
 
46
\usage{
 
47
frontierPlot(object, frontier = c("both", "lower", "upper"),
 
48
    col = c("black", "grey"), add = FALSE, labels = TRUE,
 
49
    return = c("mean", "mu"), risk = c("Cov", "Sigma", "CVaR", "VaR"),
 
50
    auto = TRUE, title = TRUE, \dots) 
 
51
 
 
52
minvariancePoints(object, return = c("mean", "mu"), 
 
53
    risk = c("Cov", "Sigma", "CVaR", "VaR"), auto = TRUE, \dots)
 
54
cmlPoints(object, return = c("mean", "mu"), 
 
55
    risk = c("Cov", "Sigma", "CVaR", "VaR"), auto = TRUE, \dots)
 
56
cmlLines(object, return = c("mean", "mu"), 
 
57
    risk = c("Cov", "Sigma", "CVaR", "VaR"), auto = TRUE, \dots)
 
58
tangencyPoints(object, return = c("mean", "mu"), 
 
59
    risk = c("Cov", "Sigma", "CVaR", "VaR"), auto = TRUE, \dots)
 
60
tangencyLines(object, return = c("mean", "mu"), 
 
61
    risk = c("Cov", "Sigma", "CVaR", "VaR"), auto = TRUE, \dots)
 
62
equalWeightsPoints(object, return = c("mean", "mu"), 
 
63
    risk = c("Cov", "Sigma", "CVaR", "VaR"), auto = TRUE, \dots)
 
64
singleAssetPoints(object, return = c("mean", "mu"), 
 
65
    risk = c("Cov", "Sigma", "CVaR", "VaR"), auto = TRUE, \dots)
 
66
twoAssetsLines(object, return = c("mean", "mu"), 
 
67
    risk = c("Cov", "Sigma", "CVaR", "VaR"), auto = TRUE, \dots)
 
68
sharpeRatioLines(object, return = c("mean", "mu"), 
 
69
    risk = c("Cov", "Sigma", "CVaR", "VaR"), auto = TRUE, \dots)
 
70
 
 
71
monteCarloPoints(object, mcSteps = 5000, return = c("mean", "mu"), 
 
72
    risk = c("Cov", "Sigma", "CVaR", "VaR"), auto = TRUE, \dots)
 
73
}
 
74
 
 
75
 
 
76
\arguments{
 
77
 
 
78
    \item{object}{
 
79
        an S4 object of class \code{fPORTFOLIO}, containing slots call, data,
 
80
        specification, constraints, portfolio, title, description.
 
81
        }
 
82
    \item{frontier}{
 
83
        a character string, determining which part of the frontier should be
 
84
        extracted. \code{"both"} stands for the full hyperbola, \code{"lower"}
 
85
        for all points below the minimum variance return and \code{"upper"}
 
86
        for the actual efficient frontier, by default "both".
 
87
        }
 
88
    \item{col}{
 
89
        a character string vector, setting the color. For \code{frontierPlot} 
 
90
        it is a two dimensional a vector; first entry is the upper part of the
 
91
        frontier,\cr second entry the lower, by default "black" and "grey".\cr
 
92
        For the other functions the argument defines the color representation,
 
93
        by default sets the default color is the rainbow palette.
 
94
        }          
 
95
    \item{add}{
 
96
        a logical value, determining whether the frontier should be added to 
 
97
        an existing plot, by default FALSE.
 
98
        }
 
99
    \item{return}{
 
100
        a character string denoting which type of return should be
 
101
        plotted. Allowed values for the
 
102
        return are either \code{"mean"}, or \code{"mu"}.
 
103
        }
 
104
    \item{risk}{
 
105
        a character string denoting which type of risk should be
 
106
        plotted. Allowed values for the
 
107
        risk measure are either \code{"cov"}, \code{"sigma"},  
 
108
        \code{"VaR"}, or \code{"CVaR"}.
 
109
        }
 
110
    \item{auto}{
 
111
        a logical flag denoting if the type of return and risk to be
 
112
        plotted should be selected automatically, by default TRUE.
 
113
        }
 
114
    \item{labels}{
 
115
        a logical flag, should the plot be automatically labeled and
 
116
        decorated? By default \code{TRUE}.
 
117
        }
 
118
    \item{title}{
 
119
        a logical flag, should the plot obtain a default main title and
 
120
        x- and y-labels? By default \code{TRUE}.
 
121
        }
 
122
    \item{mcSteps}{
 
123
        an integer value, the number of Monte Carlo steps.
 
124
        }
 
125
    \item{\dots}{
 
126
        optional arguments to be passed.
 
127
        }
 
128
 
 
129
}
 
130
 
 
131
 
 
132
\details{
 
133
 
 
134
    \bold{Frontier Plot:}\cr
 
135
    
 
136
    The \code{frontierPlot} function allows to plot the efficient
 
137
    frontier. 
 
138
    
 
139
    \emph{Selecting the upper and/or lower part of the frontier:}
 
140
    
 
141
    One can choose one from three different plot options selectable 
 
142
    by the argument \code{frontier}. 
 
143
    The part superior to the minimum variance portfolio is plotted with 
 
144
    argument \code{frontier="upper"}. 
 
145
    The part below is plotted with \code{frontier="lower"}. 
 
146
    Both parts are plotted with \code{frontier="both"}, which is default. 
 
147
    
 
148
    \emph{Selecting the color of the frontier points:}
 
149
    
 
150
    Different colors for the lower and upper part are selected from the
 
151
    argument \code{col}, the defaults are grey and black, the first for
 
152
    the lower part of the frontier, thye second for the upper part.
 
153
    
 
154
    \emph{Plotting the frontiers for several portfolios in one plot:}
 
155
    
 
156
    The function comes with an argument \code{add}. If \code{add=FALSE}
 
157
    then a new plot is opended displaying the frontier for the selected 
 
158
    portfolio. On the other hand setting \code{add=TRUE} allows to add
 
159
    new efficient frontiers from other portfolios to the same plot.
 
160
    
 
161
    \emph{Removing labels from the plot:}
 
162
    By default we have \code{labels=TRUE} and thus additional information
 
163
    is plotted on the third side of the graph. To discard this information
 
164
    one has to set \code{labels = FALSE}.
 
165
    
 
166
    \emph{Adding user supplied title and axis-labels:}
 
167
    By default we have \code{title=TRUE} and thus a default main title and 
 
168
    default x- and y-labels are automatically added. To discard this
 
169
    kind of decoration set \code{title=FALSE}. Then using the function
 
170
    \code{title} allows to add user specified titles and axis-labels. 
 
171
    
 
172
    \emph{The dot arguments:}
 
173
    With the \code{\dots} arguments one can pass additional arguments to
 
174
    the internal plot and points functions.
 
175
 
 
176
}
 
177
 
 
178
 
 
179
%\references{}
 
180
 
 
181
 
 
182
\examples{
 
183
## data -
 
184
   # Load Data:
 
185
   Data = as.timeSeries(data(smallcap.ts))
 
186
   Data = Data[, c("BKE", "GG", "GYMB", "KRON")]
 
187
   Data
 
188
 
 
189
## portfolioFrontier -
 
190
   # Compute Long Only Efficient Frontier
 
191
   Frontier = portfolioFrontier(Data)
 
192
   Frontier
 
193
   
 
194
## frontierPlot -  
 
195
   # Plot Upper Part of Frontier:
 
196
   frontierPlot(Frontier, pch = 19, xlim = c(0, 0.25), ylim = c(0, 0.035))
 
197
   grid()
 
198
   abline(h = 0, col = "grey")
 
199
   abline(v = 0, col = "grey")
 
200
   
 
201
## Plot Addons:
 
202
   minvariancePoints(Frontier, pch = 19, col = "red")
 
203
   tangencyPoints(Frontier, pch = 19, col = "blue")
 
204
   tangencyLines(Frontier, col = "blue")
 
205
   equalWeightsPoints(Frontier, pch = 15, col = "grey")
 
206
   singleAssetPoints(Frontier, pch = 19, cex = 1.5, col = topo.colors(6))
 
207
   twoAssetsLines(Frontier, lty = 3, col = "grey")
 
208
   sharpeRatioLines(Frontier, col = "orange", lwd = 2)
 
209
 
 
210
## Feasible Portfolios:
 
211
   frontierPlot(Frontier, col = c("orange", "orange"), pch = 19)
 
212
   monteCarloPoints(Frontier, mcSteps = 5000, cex = 0.25, pch = 19)
 
213
   twoAssetsLines(Frontier, lwd = 2, col = "orange")
 
214
}
 
215
 
 
216
 
 
217
\keyword{models}
 
218