PortfolioClass          package:fPortfolio          R Documentation

_P_o_r_t_f_o_l_i_o _C_l_a_s_s

_D_e_s_c_r_i_p_t_i_o_n:

     A collection and description of functions  allowing to gain
     information about optimal  portfolios. Generally, optimization is
     done  via three arguments, data, specification of  the portfolio,
     and constraints, while function portfolioFrontier() has two
     additional  arguments for title and description.  

     The functions are:

       'feasiblePortfolio'     Returns a feasible portfolio,
       'cmlPortfolio'          returns the capital market line portfolio,
       'tangencyPortfolio'     returns the tangency portfolio,
       'minvariancePortfolio'  returns the minimum variance portfolio,
       'efficientPortfolio'    returns an efficient portfolio,
       'portfolioFrontier'     returns the efficient frontier,
       'show'                  print method for 'fPPORTFOLIO' objects,
       'plot'                  plot method for objects of class fPORTFOLIO.

_U_s_a_g_e:

     portfolioFrontier(data, spec = portfolioSpec(), constraints = NULL, 
         title = NULL, description = NULL)

     feasiblePortfolio(data, spec = portfolioSpec(), constraints = NULL)
     cmlPortfolio(data, spec = portfolioSpec(), constraints = NULL)
     tangencyPortfolio(data, spec = portfolioSpec(), constraints = NULL)
     minvariancePortfolio(data, spec = portfolioSpec(), constraints = NULL)
     efficientPortfolio(data, spec = portfolioSpec(), constraints = NULL)

     show.fPORTFOLIO(object)
     ## S3 method for class 'fPORTFOLIO':
     plot(x, which = "ask", control = list(), ...)
     ## S3 method for class 'fPORTFOLIO':
     summary(object, ...)

_A_r_g_u_m_e_n_t_s:

constraints: a character string vector, containing the constraints of
          the form
           '"minW[asset]=percentage"' for box constraints resp. 
           '"maxsumW[assets]=percentage"' for sector constraints. 

 control: [plot, *Sliders] - 
           a list, defining the plotting parameters. The list modifies
          amongst others the color, e.g. 'minvariance.col', type of
          point, e.g. 'tangency.pch', or the dimension of the point,
          e.g. 'cml.cex', see Notes for a complete list of control
          parameters. 

    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. 

description: [portfolioFrontier] - 
           a character string, allowing for a brief project
          description, by default NULL, i.e. Date and User. 

  object: [show, *Sliders] - 
           an S4 object of class 'fPORTFOLIO', containing slots call,
          data, specification, constraints, portfolio, title,
          description, see Value  for a full slot description. 

    spec: an S4 object of class 'fPFOLIOSPEC', containing slots call,
          model, portfolio, title, description, see 'PortfolioSpec' for
          a full slot description. 

   title: [portfolioFrontier] - 
           a character string, containing the title for the object, by
          default NULL. 

   which: [plot] - 
           which of the plots should be displayed? 'which' can be
          either a  character string, '"all"' (displays all plots) or
          '"ask"'  (interactively asks which one to display), or a
          vector of integer values displaying the corresponding plot.
          Default value is  '"ask"'. 

       x: [plot] - 
           an S4 object of class 'fPORTFOLIO'. 

     ...: [plot, *Sliders] - 
           optional arguments to be passed.


_D_e_t_a_i_l_s:

     *Portfolio Class:* 

      This S4 class contains all information about the portfolio.
     Basically this are risk measure, mean and covariance estimation,
     target return, risk free rate, number of frontier points, ranges
     for calculation, see the "Value" section  for a detailed
     description of the slots.  

     *Portfolio Frontier:* 

      The function 'portfolioFrontier' calculates the whole efficient
     frontier. The portfolio information consists of five arguments:
     data, specifications, constraints, title and description. The data
     can be either the mean vector and the covariance matrix in a
     equivalently named list or a time series table. The specifications
     are done by the 'portfolioSpec' function, see 'PortfolioSpec'. The
     constrains have the following syntax. For bound constraints:
     '"minW[asset]=percentage"' and for sector constraints
     '"maxsumW[assets]=percentage"'. The function chooses from this
     information the right algorithm to calculate the efficient
     frontier. The function returns an S4 object of class 'fPortfolio'
     containing amongst others risk, return and weights of the whole
     efficient frontier, see Value for further details. 

     *Individual Portfolios:* 

         Individual portfolio functions allow a direct computation of
     portfolios  with specific properties. The functions are:

       'feasiblePortfolio'     a feasible portfolio,
       'cmlPortfolio'          the capital market line portfolio,
       'tangencyPortfolio'     the tangency portfolio,
       'minvariancePortfolio'  the minimum variance portfolio,
       'efficientPortfolio'    an efficient portfolio.

     The functions require three arguments: 'data', 'spec' 
     (specifications), and 'constraints', see above. The functions  are
     named according to their specific property and return the result
     of the computed or optimized portfolio as an S4 object of class 
     'fPortfolio'.

     _FeasiblePortfolio:_ The weights are retrieved from the 
     specification structure, by default they are undefined, 'NULL',
     and in this case the function 'feasiblePortfolio' assumes equal
     weights. To set user specified weights in the specification 
     structure, use the function 'setWeights'.

_V_a_l_u_e:

     'portfolioFrontier()'
      returns an S4 object of class '"fPORTFOLIO"', with the following 
     slots:

   @call: a call, returning the matched function call. 

   @data: a 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. 

@description: a character string, allowing for a brief project
          description. 

@portfolio: a 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. 

@specification: a list with one named element 'spec' which represents
          an object  of class 'fPFOLIOSPEC', including all information
          about the portfolio specifications, see 'PortfolioSpec' for
          further details. 

  @title: a title string. 


     'feasiblePortfolio'
      'cmlPortfolio'
      'tangencyPortfolio'
      'minvariancePortfolio'
      'efficientPortfolio'
      return an S4 object of class 'fPORTFOLIO' having information only
      about one portfolio.

_C_o_n_t_r_o_l _P_a_r_a_m_e_t_e_r_s:

     In the following all elements of argument control from functions
     'plot', 'weightsSlider', 'frontierSlider' are listed. 

     _s_l_i_d_e_r_R_e_s_o_l_u_t_i_o_n [weightsSlider, frontierSlider] -  a numeric,
          determining the numbers of slider points, by default 
          nFrontierPoints/10. 

     _s_l_i_d_e_r_F_l_a_g [weightsSlider, frontierSlider] -  a character string,
          denoting the slidertype, by default "frontier" for
          'frontierSlider' and "weights" for 'weightsSlider'. 

     _s_h_a_r_p_e_R_a_t_i_o._c_o_l [plot, frontierSlider] -  a character string,
          defining color of the Sharpe ratio plot, by default "black".

     _m_i_n_v_a_r_i_a_n_c_e._c_o_l a character string, defining color of the minimum
          variance portfolio, by default "red".

     _t_a_n_g_e_n_c_y._c_o_l a character string, defining color of the tangency
          portfolio, by default "steelblue".

     _c_m_l._c_o_l [plot, frontierSlider] -  a character string, defining 
          color of the market portfolio and the capital market line, by
          default "green".

     _e_q_u_a_l_W_e_i_g_h_t_s._c_o_l [plot, frontierSlider] -  a character string,
          defining the color of the equal weights portfolio, by default
          "blue".

     _r_u_n_n_i_n_g_P_o_i_n_t._c_o_l [weightsSlider] -  a character string, defining
          color of the point indicating the current portfolio, by
          default "red".

     _s_i_n_g_l_e_A_s_s_e_t._c_o_l a character string vector, defining color of the
          single asset portfolios. The vector must have length the
          number  of assets, by default 'rainbow'.

     _t_w_o_A_s_s_e_t_s._c_o_l [plot, frontierSlider] -  a character string,
          defining color of the two assets efficient frontier, by
          default "grey".

     _m_o_n_t_e_C_a_r_l_o._c_o_l [plot, frontierSlider] -  a character string,
          defining color of the Monte Carlo portfolios, by default
          "black". 

     _m_i_n_v_a_r_i_a_n_c_e._p_c_h a number, defining symbol used for the minimum
          variance portfolio. See 'points' for description. Default
          symbol is 17.

     _t_a_n_g_e_n_c_y._p_c_h a number, defining symbol used for the tangency
          portfolio. See 'points' for description. Default symbol is
          17.

     _c_m_l._p_c_h [plot, frontierSlider] -  a number, defining symbol used
          for the market portfolio. See 'points' for description.
          Default symbol is 17.

     _e_q_u_a_l_W_e_i_g_h_t_s._p_c_h [plot, frontierSlider] -  a number, defining
          symbol used for the equal weights portfolio. See 'points' for
          description. Default symbol is 15. 

     _s_i_n_g_l_e_A_s_s_e_t._p_c_h a number, defining symbol used for the single
          asset portfolios. See 'points' for description. Default
          symbol is 18. 

     _s_h_a_r_p_e_R_a_t_i_o._c_e_x [plot, frontierSlider] -  a number, determining
          size (percentage) of the Sharpe ratio plot, by default 0.1.

     _m_i_n_v_a_r_i_a_n_c_e._c_e_x a number, determining size (percentage) of the
          minimum variance portfolio symbol, by default 1.

     _t_a_n_g_e_n_c_y._c_e_x a number, determining size (percentage) of the
          tangency portfolio symbol, by default 1.25.

     _c_m_l._c_e_x [plot, frontierSlider] -  a number, determining size
          (percentage) of the market portfolio symbol, by default 1.25.

     _e_q_u_a_l_W_e_i_g_h_t_s._c_e_x [plot, frontierSlider] -  a number, determining
          size (percentage) of the equal weights portfolio symbol, by
          default 0.8.

     _r_u_n_n_i_n_g_P_o_i_n_t._c_e_x [weightsSlider] -  a number, determining size
          (percentage) of the point indicating the current portfolio
          equal weights portfolio symbol, by default 0.8.

     _s_i_n_g_l_e_A_s_s_e_t._c_e_x a number, determining size (percentage) of the
          singel asset portfolio symbols, by default 0.8.

     _t_w_o_A_s_s_e_t_s._c_e_x [plot, frontierSlider] -  a number, determining size
          (percentage) of the two assets efficient frontier plot, by
          default 0.01.

     _m_o_n_t_e_C_a_r_l_o._c_e_x [plot, frontierSlider] -  a number, determining
          size (percentage) of the Monte Carol portfolio symbols, by
          default 0.01. 

     _m_o_n_t_e_C_a_r_l_o._c_e_x [plot, frontierSlider] -  a number, determining
          size (percentage) of the Monte Carol portfolio symbols, by
          default 0.01.

     _m_c_S_t_e_p_s [plot] -  a number, determining number of Monte Carol
          portfolio, by default 5000.

     _p_i_e_R [plot, frontierSlider] -  a vector, containing factors for
          shrinking and stretching the x- and y-axis, by default NULL,
          i.e. c(1, 1) is used. Default pie size is  1/15 of the plot
          range.

     _p_i_e_P_o_s [plot, frontierSlider] -  a number, determining the weight
          on the efficient frontier, which is illustrated by the pie.
          Default is tangency portfolio

     _p_i_e_O_f_f_s_e_t [plot, frontierSlider] -  a vector, containing the pie's
          x- and y-axis offset from the efficient frontier. Default is
          NULL, i.e. the pie is set one default radius left of the
          efficient frontier.

     _x_l_i_m [weightsSlider, frontierSlider] -  a vector, containing
          x-axis plot limits of the efficient frontier. Default setting
          is maximum of frontier range or single assets  portfolios.

     _y_l_i_m [weightsSlider, frontierSlider] -  a vector, containing
          y-axis plot limits of the efficient frontier. Default setting
          is maximum of frontier range or single assets  portfolios.  

_A_u_t_h_o_r(_s):

     Diethelm Wuertz and Oliver Greshake for the Rmetrics port.

_S_e_e _A_l_s_o:

     'PortfolioData', 'PortfolioSpec', 'PortfolioConstraints',
     'PortfolioPlots', 'PortfolioPlots'.

_E_x_a_m_p_l_e_s:

     ## minvariancePortfolio -
        # Load Data and Convert to timeSeries Object:
        Data = as.timeSeries(data(smallcap.ts))
        Data = Data[, c("BKE", "GG", "GYMB", "KRON")]
        Data
        # Set Default Specifications:
        Spec = portfolioSpec()
        Spec
        # Allow for unlimited Short Selling:
        Constraints = "Short"
        # Compute Short Selling Minimum Variance Portfolio
        minvariancePortfolio(Data, Spec, Constraints)
         
     ## 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 -
        # Try Frontier Slider:
        # frontierSlider(frontier)

