Description Usage Arguments Details Value Author(s) References See Also Examples
optimalPort
estimates the optimal portfolio based on a stock model and data set.
1 | optimalPort(model, Rf = NULL, shortSell = NULL, eps = 10^(-4))
|
model |
An object of class |
Rf |
An optional argument to update the risk free rate. |
shortSell |
An optional argument to update short-selling. |
eps |
An error term to be used in evaluating whether the risk-free rate is acceptable. This argument should not be adjusted except by advanced users. |
When the function returns an error regarding the validity of Rf
, the risk free rate of return, this is not a bug. That error message means the Rf
is too large; it is larger than the expected return of the vertex of the portfolio possibilities curve (the left-most point on this curve). When this occurs, no tangent line can be created along the efficient frontier. The implication is that a lower Rf should be specified to identify a portfolio along the efficient frontier of the portfolio possibilities curve.
This Rf issue has happened relatively frequently with stocks in the last few years. So many stocks are down, which sometimes results in a minimum risk portfolios with an expected return that is negative.
optimalPort
outputs an object of class "optimalPortfolio"
, which is a list of
model |
An object of class |
X |
The allocation of the optimal portfolio. |
R |
The estimated return associated with allocation |
risk |
The estimated risk associated with allocation |
David Diez and Nicolas Christou
Markowitz, Harry. "Portfolio Selection Efficient Diversification of Investments." New York: John Wiley and Sons, 1959.
Elton, Edwin, J., Gruber, Martin, J., Padberg, Manfred, W. "Simple Criteria for Optimal Portfolio Selection," Journal of Finance, XI, No. 5 (Dec. 1976), pp. 1341-1357.
Elton, Edwin, J., Gruber, Martin, J., Padberg, Manfred, W. "Simple Rules for Optimal Portfolio Selection: The Multi Group Case," Journal of Financial and Quantitative Analysis, XII, No. 3 (Sept. 1977), pp. 329-345.
Elton, Edwin, J., Gruber, Martin, J., Padberg, Manfred, W. "Simple Criteria for Optimal Portfolio Selection: Tracing Out the Efficient Frontier," Journal of Finance, XIII, No. 1 (March 1978), pp. 296-302.
getReturns
, stockModel
, testPort
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 | #===> obtain data <===#
data(stock99)
data(stock94Info)
mgm <- stockModel(stock99, drop=25, model='MGM', industry=stock94Info$industry)
#===> build optimal portfolios <===#
opMgm1 <- optimalPort(mgm)
opMgm2 <- optimalPort(mgm, Rf=0.004)
print(opMgm1)
summary(opMgm1)
#===> plot the optimal porfolios <===#
par(mfrow=c(1,2))
# these plots provide a "head coloring" of
# the allocation by optimalPort
plot(opMgm1)
plot(opMgm2)
#===> additional plotting 1 <===#
par(mfrow=c(1,1))
plot(opMgm1, addNames=TRUE)
#===> additional plotting 2 <===#
plot(opMgm1, optPortOnly=TRUE, colOP=2, pchOP=2)
points(opMgm2, colOP=2, pchOP=4)
#=====> Watch out -- choosing Rf too large causes errors <=====#
data(stock99)
data(stock94Info)
non <- stockModel(stock99, drop=25, model='none',
industry=stock94Info$industry)
portPossCurve(non)
opTemp <- optimalPort(non, Rf=-10^5)
points(opTemp)
## Error if Rf >= vertex (y value)
# optimalPort(non, 0.02)
# optimalPort(non, opTemp$R)
# optimalPort(non, opTemp$R+0.01)
# optimalPort(non, opTemp$R-0.01)
## May give error if Rf too close to vertex
# optimalPort(non, opTemp$R-0.0001)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.