Learn R Programming

fPortfolio (version 280.74)

feasiblePortfolio: Portfolio Class

Description

Returns properties of a feasible portfolio.

Usage

feasiblePortfolio(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

  • feasiblePortfolio function returns an S4 object of class "fPORTFOLIO", with the following slots:
  • @calla call, returning the matched function call.
  • @dataa list with two named elements, series holding the time series data if available, otherwise NA, and statistics, itself a named list with two named elements mu and Sigma holding the vector of means and the matrix of covariances.
  • @descriptiona character string, allowing for a brief project description.
  • @portfolioa list, containing parameter specifications for the portfolio: weights a numeric vector specifying the portfolio weights, targetReturn a numeric value specifying the target return, targetRisk a numeric value specifying the target risk, targetMean a numeric value specifying the target return determinated with function mean(), targetStdev a numeric value specifying the target risk in standart deviation as risk measure.
  • @specificationa list with one named element spec which represents an object of class fPFOLIOSPEC, including all information about the portfolio specifications.
  • @titlea title string.

Details

A Feasible Portfolio: A feasible portfolio is a portfolio with given weights which lies inside the feasible region of portfolios. The function requires three arguments: data, spec (specifications), and constraints, see above. Be sure that the specification structure "spec" has defined a weights vector which is different from "NULL". To assign values to the weights in the specification structure, use the function setWeights. The feasiblePortfolio function returns the properties of the feasible portfolio as an S4 object of class fPORTFOLIO.

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()
   setWeights(Spec) = rep(0.25, times = 4)
   Spec
   
## Allow for unlimited Short Selling:
   Constraints = "LongOnly"
   
## Compute properties of Efficient Portfolio
   feasiblePortfolio(Data, Spec, Constraints)

Run the code above in your browser using DataLab