[R-SIG-Finance] fPortfolio and efficient frontier
John P. Burkett
burkett at uri.edu
Sat May 3 22:22:27 CEST 2008
Using R version 2.6.1 with package fPortfolio (260.72) running under
Gentoo Linux, I am trying to calculate and plot an efficient frontier,
following the example in "The fPortfolio Package" (February 16, 2008),
p. 10.
My input code is the following:
Data = as.timeSeries(data(smallcap.ts))
Data = Data[, c("BKE", "GG", "GYMB", "KRON")]
Data
# Set Default Specifications:
Spec = portfolioSpec()
Spec
## portfolioFrontier -
# Modify Constraints - Now Long Only Constraints:
Constraint = c("minW[1:nAssets]=0")
# Calculation of the Efficient Frontier
frontier = portfolioFrontier(Data, Spec, Constraint)
print(frontier)
## plot -
# Plot Efficient Frontier with Minimum Variance Portfolio
plot(frontier, which = c(1, 3))
frontierSlider(frontier)
The output is not the hyperbola I had expected. The command
frontierSlider(frontier) produces an asymmetric curve whose upper branch
is flatter than its lower branch. At first I suspected this was just a
graphical distortion. However, inspecting the numerical output of
print(frontier), I see the same asymmetry: Risk is minimized at the
point (.09307886, 02653167) but the curve is not symmetrical around a
horizontal line through this point. (Comparing the points 13, 31, and 49
makes this clear. The differences in return between points 13 and 31 and
between points 31 and 49 are virtually the same, but the difference in
risk between points 13 and 31 is far less than between points 31 and 49.)
Is the asymmetry a bug or does it accurately represent an efficiency
frontier of a kind different from the textbook hyperbolas?
Best regards,
John
--
John P. Burkett
Department of Environmental and Natural Resource Economics
and Department of Economics
University of Rhode Island
Kingston, RI 02881-0808
USA
phone (401) 874-9195
More information about the R-SIG-Finance
mailing list