Portfolio optimization and analysis routines and graphics.

Automated backtesting of multiple portfolios over multiple 
    datasets of stock prices in a rolling-window fashion. Intended for 
    researchers and practitioners to backtest a set of different portfolios, 
    as well as by a course instructor to assess the students in their portfolio 
    design in a fully automated and convenient manner, with results conveniently 
    formatted in tables and plots. Each portfolio design is easily defined as a
    function that takes as input a window of the stock prices and outputs the 
    portfolio weights. Multiple portfolios can be easily specified as a list 
    of functions or as files in a folder. Multiple datasets can be conveniently 
    extracted randomly from different markets, different time periods, and 
    different subsets of the stock universe. The results can be later assessed 
    and ranked with tables based on a number of performance criteria (e.g., 
    expected return, volatility, Sharpe ratio, drawdown, turnover rate, return 
    on investment, computational time, etc.), as well as plotted in a number of 
    ways with nice barplots and boxplots.

Two functions for financial portfolio optimization by linear programming are provided. One function implements Benders decomposition algorithm and can be used for very large data sets. The other, applicable for moderate sample sizes, finds optimal portfolio which has the smallest distance to a given benchmark portfolio.

Provides a simple method to extract portions of a vector, matrix, or data.frame. 
    The relative portion size and the way the portion is selected can be chosen.

The functions are designed to find the efficient mean-variance frontier or 
 portfolio weights for static portfolio (called  Markowitz portfolio) analysis in resource 
 economics or nature conservation. Using the nonlinear programming solver ('Rsolnp'), 
 this package deals with the quadratic minimization of the variance-covariances without 
 shorting (i.e., non-negative portfolio weights) studied in Ando and Mallory (2012) 
 <doi:10.1073/pnas.1114653109>. See the examples, testing versions, and more details from: 
 <https://github.com/ysd2004/portn>.