Learn R Programming

PortfolioAnalytics (version 2.0.0)

Portfolio Analysis, Including Numerical Methods for Optimization of Portfolios

Description

Portfolio optimization and analysis routines and graphics.

Copy Link

Version

Install

install.packages('PortfolioAnalytics')

Monthly Downloads

2,769

Version

2.0.0

License

GPL-3

Issues

Pull Requests

Stars

Forks

Last Published

July 3rd, 2024

Functions in PortfolioAnalytics (2.0.0)

HHI

Concentration of weights
MycovRobMcd

Control settings for custom.covRob.Mcd
MycovRobTSGS

Control settings for custom.covRob.TSGS
ac.ranking

Asset Ranking
PortfolioAnalytics-package

Numeric methods for optimization of portfolios
add.sub.portfolio

Add sub-portfolio
barplotGroupWeights

barplot of group weights by group or category
center

Center
centroid.complete.mc

Complete Cases Centroid
backtest.plot

generate plots of the cumulative returns and drawdown for back-testing
centroid.sectors

Multiple Sectors Centroid
black.litterman

Black Litterman Estimates
box_constraint

constructor for box_constraint.
applyFUN

Apply a risk or return function to a set of weights
centroid.buckets

Buckets Centroid
chart.EfficientFrontierCompare

Overlay the efficient frontiers of different minRisk portfolio objects on a single plot.
chart.EfficientFrontierOverlay

Plot multiple efficient frontiers
chart.Weights

boxplot of the weights of the optimal portfolios
chart.RiskReward

classic risk reward scatter
chart.RiskBudget

Generic method to chart risk contribution
chart.GroupWeights

Chart weights by group or category
cokurtosisMF

Cokurtosis Matrix Estimate
check_constraints

check if a set of weights satisfies the constraints
centroid.sign

Positive and Negative View Centroid
chart.Concentration

Classic risk reward scatter and concentration
combine.optimizations

Combine objects created by optimize.portfolio
cokurtosisSF

Cokurtosis Matrix Estimate
constrained_objective

calculate a numeric return value for a portfolio based on a set of constraints and objectives
combine.portfolios

Combine a list of portfolio objects
custom.covRob.TSGS

Compute returns mean vector and covariance matrix with custom.covRob.TSGS
custom.covRob.Mcd

Compute returns mean vector and covariance matrix with custom.covRob.Mcd
custom.covRob.MM

Compute returns mean vector and covariance matrix with custom.covRob.MM
create.EfficientFrontier

create an efficient frontier
coskewnessMF

Coskewness Matrix Estimate
coskewnessSF

Coskewness Matrix Estimate
diversification

Function to compute diversification as a constraint
covarianceSF

Covariance Matrix Estimate
covarianceMF

Covariance Matrix Estimate
etl_milp_opt

Minimum ETL MILP Optimization
custom.covRob.Rocke

Compute returns mean vector and covariance matrix with custom.covRob.Rocke
etl_opt

Minimum ETL LP Optimization
chart.EF.Weights

Chart weights along an efficient frontier
constraint_v1

constructors for class constraint
diversification_constraint

constructor for diversification_constraint
chart.EfficientFrontier

Chart the efficient frontier and risk-return scatter
constraint_ROI

constructor for class constraint_ROI
extractStats

extract some stats and weights from a portfolio run via optimize.portfolio
equal.weight

Create an equal weight portfolio
gmv_opt_leverage

GMV/QU QP Optimization with Turnover Constraint
gmv_opt_ptc

GMV/QU QP Optimization with Proportional Transaction Cost Constraint
extractCovariance

Covariance Estimate
leverage_exposure_constraint

constructor for leverage_exposure_constraint
get_constraints

Helper function to get the enabled constraints out of the portfolio object When the v1_constraint object is instantiated via constraint, the arguments min_sum, max_sum, min, and max are either specified by the user or default values are assigned. These are required by other functions such as optimize.portfolio and constrained_objective . This function will check that these variables are in the portfolio object in the constraints list. We will default to min_sum=1 and max_sum=1 if leverage constraints are not specified. We will default to min=-Inf and max=Inf if box constraints are not specified. This function is used at the beginning of optimize.portfolio and other functions to extract the constraints from the portfolio object. We Use the same naming as the v1_constraint object.
gmv_opt

GMV/QU QP Optimization
maxret_milp_opt

Maximum Return MILP Optimization
extractEfficientFrontier

Extract the efficient frontier data points
extractCokurtosis

Cokurtosis Estimate
mult.portfolio.spec

Multple Layer Portfolio Specification
extractWeights

Extract weights from a portfolio run via optimize.portfolio or optimize.portfolio.rebalancing
extractCoskewness

Coskewness Estimate
fn_map

mapping function to transform or penalize weights that violate constraints
generatesequence

create a sequence of possible weights for random or brute force portfolios
is.constraint

check function for constraints
inverse.volatility.weight

Create an inverse volatility weighted portfolio
meanvar.efficient.frontier

Generate the efficient frontier for a mean-variance portfolio
factor_exposure_constraint

Constructor for factor exposure constraint
group_fail

Test if group constraints have been violated
gmv_opt_toc

GMV/QU QP Optimization with Turnover Constraint
extract_risk

extract the risk value when knowing the weights
indexes

Six Major Economic Indexes
extractGroups

Extract the group and/or category weights
group_constraint

constructor for group_constraint
pHist

Generates histogram
name.replace

utility function to replace awkward named from unlist
optimize.portfolio.rebalancing

Portfolio Optimization with Rebalancing Periods
portfolio.spec

constructor for class portfolio
optimize.portfolio

Constrained optimization of portfolios
print.portfolio

Printing Portfolio Specification Objects
minmax_objective

constructor for class tmp_minmax_objective
optimize.portfolio.parallel

Execute multiple optimize.portfolio calls, presumably in parallel
extractObjectiveMeasures

Extract the objective measures
meucci.ranking

Asset Ranking
insert_objectives

Insert a list of objectives into the objectives slot of a portfolio object
insert_constraints

Insert a list of constraints into the constraints slot of a portfolio object
maxret_opt

Maximum Return LP Optimization
is.objective

check class of an objective object
is.portfolio

check function for portfolio
print.summary.optimize.portfolio.rebalancing

Printing summary output of optimize.portfolio.rebalancing
portfolio_risk_objective

constructor for class portfolio_risk_objective
meucci.moments

Compute moments
plot.optimize.portfolio.DEoptim

plot method for objects of class optimize.portfolio
print.summary.optimize.portfolio

Printing summary output of optimize.portfolio
quadratic_utility_objective

constructor for quadratic utility objective
plotFrontiers

Generate efficient frontiers plot by providing frontiers.
meanetl.efficient.frontier

Generate the efficient frontier for a mean-etl portfolio
meaneqs.efficient.frontier

Generate the efficient frontier for a mean-EQS portfolio
portfolio.moments.bl

Portfolio Moments
set.portfolio.moments

Portfolio Moments
print.constraint

print method for constraint objects
portfolio.moments.boudt

Portfolio Moments
random_walk_portfolios

deprecated random portfolios wrapper until we write a random trades function
print.optimize.portfolio.ROI

Printing output of optimize.portfolio
risk_budget_objective

constructor for class risk_budget_objective
randomize_portfolio

version 2 generate random permutations of a portfolio seed meeting your constraints on the weights of each asset
print.optimize.portfolio.rebalancing

Printing output of optimize.portfolio.rebalancing
return_constraint

constructor for return_constraint
objective

constructor for class 'objective'
print.efficient.frontier

Print an efficient frontier object
meanrisk.efficient.frontier

Generate multiple efficient frontiers for the same portfolio
opt.outputMvo

Optimal Portfolio Weights and Performance Values
pos_limit_fail

function to check for violation of position limits constraints
regime.portfolios

Regime Portfolios
randomize_portfolio_v1

Random portfolio sample method
rp_grid

Generate random portfolios based on grid search method
transaction_cost_constraint

constructor for transaction_cost_constraint
weight_sum_constraint

constructor for weight_sum_constraint
turnover

Calculates turnover given two vectors of weights. This is used as an objective function and is called when the user adds an objective of type turnover with add.objective
statistical.factor.model

Statistical Factor Model
position_limit_constraint

constructor for filter_constraint
random_portfolios_v1

generate an arbitary number of constrained random portfolios
scatterFUN

Apply a risk or return function to asset returns
random_portfolios

version 2 generate an arbitary number of constrained random portfolios
rp_transform

Transform a weights vector to satisfy constraints
rp_sample

Generate random portfolios using the sample method
turnover_objective

constructor for class turnover_objective
return_objective

constructor for class return_objective
rp_simplex

Generate random portfolios using the simplex method
turnover_constraint

constructor for turnover_constraint
trailingFUN

apply a function over a configurable trailing period
summary.portfolio

Summarize Portfolio Specification Objects
update_constraint_v1tov2

Helper function to update v1_constraint objects to v2 specification in the portfolio object
summary.efficient.frontier

Summarize an efficient frontier object
update.constraint

function for updating constrints, not well tested, may be broken
set.portfolio.moments_v1

set portfolio moments for use by lower level optimization functions
summary.optimize.portfolio

Summarizing output of optimize.portfolio
summary.optimize.portfolio.rebalancing

summary method for optimize.portfolio.rebalancing
var.portfolio

Calculate portfolio variance
weight_concentration_objective

Constructor for weight concentration objective
BlackLittermanFormula

Computes the Black-Litterman formula for the moments of the posterior normal.
add.constraint

General interface for adding and/or updating optimization constraints.
add.objective

General interface for adding optimization objectives, including risk, return, and risk budget
CCCgarch.MM

compute comoments for use by lower level optimization functions when the conditional covariance matrix is a CCC GARCH model
EntropyProg

Entropy pooling program for blending views on scenarios with a prior scenario-probability distribution