Learn R Programming

fPortfolio (version 280.74)

efficientPortfolio: Efficient Portfolios

Description

Returns efficient portfolios.

Usage

efficientPortfolio(data, spec = portfolioSpec(), constraints = "LongOnly")

maxratioPortfolio(data, spec = portfolioSpec(), constraints = "LongOnly") tangencyPortfolio(data, spec = portfolioSpec(), constraints = "LongOnly")

minriskPortfolio(data, spec = portfolioSpec(), constraints = "LongOnly") minvariancePortfolio(data, spec = portfolioSpec(), constraints = "LongOnly")

maxreturnPortfolio(data, spec = portfolioSpec(), constraints = "LongOnly")

Arguments

constraints
a character string vector, containing the constraints of the form "minW[asset]=percentage" for box constraints resp. "maxsumW[assets]=percentage" for sector constraints.
data
a multivariate time series described by an S4 object of class timeSeries. If your timeSerie is not a timeSeries object, consult the generic function as.timeSeries to convert your time series.
spec
an S4 object of class fPFOLIOSPEC as returned by the function portfolioSpec.

Value

  • returns an S4 object of class "fPORTFOLIO".

Details

Efficient Portfolio: An efficient portfolio is a portfolio which lies on the efficient frontier. The weights have to be optimized. The function requires three arguments: data, spec (specifications), and constraints, see above. Be sure that the specification structure has undefined weights, NULL. In addition, only one, either the target return or the target risk is defined vector which is different from "NULL". This determines which type of optimization should be done. If the risk is given and the return is missing, then the return will be maximized for the given risk. On the other hand, if the return is given and the risk is missing, then the risk will be minimizes for the given return. To assign values either to the target return or target trisk in the specification structure, use the functions settargetReturn and setTargetRisk. The efficeentPortfolio function returns the properties of the efficient portfolio as an S4 object of class fPORTFOLIO. The efficient Portfolio Tree: Optimize: Type: Constraints: Solver: + short +--MV------+ lin | + quad | +-MinRisk----+--LPM-----+ lin | | + quad | | | +--CVaR----+ lin | + quad | efficientPortfolio-+ | + short | +--MV------+ lin | | + quad | | +-MaxReturn--+--LPM-----+ lin | + quad | +--CVaR----+ lin + quad Tangency Portfolio: The function tangencyPortfolio returns the portfolio with the highest return/risk ratio on the efficient frontier. For the Markowitz portfolio this is the same as the Sharpae ratio. To find this point on the frontier the return/risk ratio calculated from the target return and target risk returned by the function efficientPortfolio. Note, the default value of the risk free rate is zero.

Minimum Variance Portfolio: The function minvariancePortfolio returns the portfolio with the minimal risk on the efficient frontier. To find the minimal risk point the target risk returned by the function efficientPortfolio is minimized. Maximum Return Portfolio: The function maxreturnPortfolio returns the portfolio with the maximal return for a fixed target risk.

Examples

Run this code
## data -
   # Load Data and Convert to timeSeries Object:
   Data = as.timeSeries(data(smallcap.ts))
   Data = Data[, c("BKE", "GG", "GYMB", "KRON")]
   Data
   
## portfolioSpec -
   # Set Default Specifications:
   Spec = portfolioSpec()
   Spec
   setTargetReturn(Spec) = mean(colMeans(Data))
   
## Allow for unlimited Short Selling:
   Constraints = "LongOnly"
   
## efficientPortfolio -
   # Compute properties of efficient Portfolio:
   efficientPortfolio(Data, Spec, Constraints)
   
## tangency Portfolio -
   # Compute properties of tangency Portfolio:
   tangencyPortfolio(Data, Spec, Constraints)   
   
## minvariancePortfolio -
   # Compute properties of minimum variance Portfolio:
   minvariancePortfolio(Data, Spec, Constraints)

Run the code above in your browser using DataLab