Package: PortfolioAnalytics 2.1.0

Brian G. Peterson

PortfolioAnalytics: Portfolio Analysis, Including Numerical Methods for Optimization of Portfolios

Portfolio optimization and analysis routines and graphics.

Authors:Brian G. Peterson [cre, aut, cph], Peter Carl [aut, cph], Ross Bennett [ctb, cph], Kris Boudt [ctb, cph], Xinran Zhao [cph], R. Douglas Martin [ctb], Guy Yollin [ctb], Hezky Varon [ctb], Xiaokang Feng [ctb], Yifu Kang [ctb]

PortfolioAnalytics_2.1.0.tar.gz
PortfolioAnalytics_2.1.0.tar.gz(r-4.5-noble)PortfolioAnalytics_2.1.0.tar.gz(r-4.4-noble)
PortfolioAnalytics_2.1.0.tgz(r-4.4-emscripten)PortfolioAnalytics_2.1.0.tgz(r-4.3-emscripten)
PortfolioAnalytics.pdf |PortfolioAnalytics.html
PortfolioAnalytics/json (API)

# Install 'PortfolioAnalytics' in R:
install.packages('PortfolioAnalytics', repos = c('https://cran.r-universe.dev', 'https://cloud.r-project.org'))

Peer review:

Bug tracker:https://github.com/braverock/portfolioanalytics/issues

Datasets:
  • indexes - Six Major Economic Indexes

7.80 score 7 stars 2 packages 640 scripts 4.0k downloads 114 exports 18 dependencies

Last updated 22 days agofrom:f97b0e9e16. Checks:OK: 2. Indexed: no.

TargetResultDate
Doc / VignettesOKDec 04 2024
R-4.5-linux-x86_64OKDec 04 2024

Exports:ac.rankingadd.constraintadd.objectiveadd.objective_v1add.objective_v2add.sub.portfolioapplyFUNbacktest.plotblack.littermanbox_constraintCCCgarch.MMcentercentroid.bucketscentroid.complete.mccentroid.sectorscentroid.signchart.Concentrationchart.EF.Weightschart.EfficientFrontierchart.EfficientFrontierComparechart.EfficientFrontierOverlaychart.GroupWeightschart.RiskBudgetchart.RiskRewardchart.Weightscombine.optimizationscombine.portfoliosconstrained_objectiveconstrained_objective_v1constrained_objective_v2constraintconstraint_ROIconstraint_v1constraint_v2create.EfficientFrontiercustom.covRob.Mcdcustom.covRob.MMcustom.covRob.Rockecustom.covRob.TSGSdiversificationdiversification_constraintEntropyProgequal.weightextract_riskextractCokurtosisextractCoskewnessextractCovarianceextractEfficientFrontierextractGroupsextractObjectiveMeasuresextractStatsextractWeightsfactor_exposure_constraintfn_mapgeneratesequencegroup_constraintHHIinsert_objectivesinverse.volatility.weightis.constraintis.objectiveis.portfolioleverage_exposure_constraintmeancsm.efficient.frontiermeanetl.efficient.frontiermeanrisk.efficient.frontiermeanvar.efficient.frontiermeucci.momentsmeucci.rankingminmax_objectivemult.portfolio.specMycovRobMcdMycovRobTSGSobjectiveopt.outputMvooptimize.portfoliooptimize.portfolio_v1optimize.portfolio_v2optimize.portfolio.paralleloptimize.portfolio.rebalancingoptimize.portfolio.rebalancing_v1plotFrontiersportfolio_risk_objectiveportfolio.specpos_limit_failposition_limit_constraintquadratic_utility_objectiverandom_portfoliosrandom_portfolios_v1random_portfolios_v2random_walk_portfoliosrandomize_portfoliorandomize_portfolio_v1randomize_portfolio_v2regime.portfoliosreturn_constraintreturn_objectiverisk_budget_objectiverp_gridrp_samplerp_simplexrp_transformscatterFUNset.portfolio.momentsstatistical.factor.modeltrailingFUNtransaction_cost_constraintturnoverturnover_constraintturnover_objectiveupdate_constraint_v1tov2var.portfolioweight_concentration_objectiveweight_sum_constraint

Dependencies:backportscheckmatecodetoolsforeachGenSAiteratorslatticemcoPerformanceAnalyticspsoquadprogregistryROIROI.plugin.symphonyRsymphonyslamxtszoo

An Introduction to Portfolio Optimization with PortfolioAnalytics

Rendered fromportfolio_vignette.Rnwusingutils::Sweaveon Dec 04 2024.

Last update: 2024-12-04
Started: 2015-04-18

Custom Moment and Objective Functions

Rendered fromcustom_moments_objectives.Rnwusingutils::Sweaveon Dec 04 2024.

Last update: 2024-12-04
Started: 2015-04-18

CVXR for PortfolioAnalytics

Rendered fromcvxrPortfolioAnalytics.pdf.asisusingR.rsp::asison Dec 04 2024.

Last update: 2024-07-04
Started: 2024-07-04

Portfolio Optimization with CVaR budgets in PortfolioAnalytics

Rendered fromrisk_budget_optimization.Rnwusingutils::Sweaveon Dec 04 2024.

Last update: 2024-12-04
Started: 2015-04-18

Portfolio Optimization with ROI in PortfolioAnalytics

Rendered fromROI_vignette.Rnwusingutils::Sweaveon Dec 04 2024.

Last update: 2024-12-04
Started: 2015-04-18

Using Robust Covariance Matrix Estimators in PortfolioAnalytics

Rendered fromrobustCovMatForPA.pdf.asisusingR.rsp::asison Dec 04 2024.

Last update: 2024-07-04
Started: 2024-07-04

Readme and manuals

Help Manual

Help pageTopics
Numeric methods for optimization of portfoliosPortfolioAnalytics-package PortfolioAnalytics
Asset Rankingac.ranking
General interface for adding and/or updating optimization constraints.add.constraint
General interface for adding optimization objectives, including risk, return, and risk budgetadd.objective add.objective_v1 add.objective_v2
Add sub-portfolioadd.sub.portfolio
Apply a risk or return function to a set of weightsapplyFUN
generate plots of the cumulative returns and drawdown for back-testingbacktest.plot
barplot of group weights by group or categorybarplotGroupWeights
Black Litterman Estimatesblack.litterman
Computes the Black-Litterman formula for the moments of the posterior normal.BlackLittermanFormula
constructor for box_constraint.box_constraint
compute comoments for use by lower level optimization functions when the conditional covariance matrix is a CCC GARCH modelCCCgarch.MM
Centercenter
Buckets Centroidcentroid.buckets
Complete Cases Centroidcentroid.complete.mc
Multiple Sectors Centroidcentroid.sectors
Positive and Negative View Centroidcentroid.sign
Classic risk reward scatter and concentrationchart.Concentration
Chart weights along an efficient frontierchart.EF.Weights chart.EF.Weights.efficient.frontier chart.EF.Weights.optimize.portfolio
Chart the efficient frontier and risk-return scatterchart.EfficientFrontier chart.EfficientFrontier.efficient.frontier chart.EfficientFrontier.optimize.portfolio chart.EfficientFrontier.optimize.portfolio.CVXR chart.EfficientFrontier.optimize.portfolio.ROI
Overlay the efficient frontiers of different minRisk portfolio objects on a single plot.chart.EfficientFrontierCompare
Plot multiple efficient frontierschart.EfficientFrontierOverlay
Chart weights by group or categorychart.GroupWeights
Generic method to chart risk contributionchart.RiskBudget chart.RiskBudget.opt.list chart.RiskBudget.optimize.portfolio chart.RiskBudget.optimize.portfolio.rebalancing
classic risk reward scatterchart.RiskReward chart.RiskReward.opt.list chart.RiskReward.optimize.portfolio.DEoptim chart.RiskReward.optimize.portfolio.GenSA chart.RiskReward.optimize.portfolio.pso chart.RiskReward.optimize.portfolio.random chart.RiskReward.optimize.portfolio.ROI
boxplot of the weights of the optimal portfolioschart.Weights chart.Weights.opt.list chart.Weights.optimize.portfolio.DEoptim chart.Weights.optimize.portfolio.GenSA chart.Weights.optimize.portfolio.pso chart.Weights.optimize.portfolio.random chart.Weights.optimize.portfolio.rebalancing chart.Weights.optimize.portfolio.ROI
check if a set of weights satisfies the constraintscheck_constraints
Cokurtosis Matrix EstimatecokurtosisMF
Cokurtosis Matrix EstimatecokurtosisSF
Combine objects created by optimize.portfoliocombine.optimizations
Combine a list of portfolio objectscombine.portfolios
calculate a numeric return value for a portfolio based on a set of constraints and objectivesconstrained_objective constrained_objective_v1 constrained_objective_v2
constructor for class constraint_ROIconstraint_ROI
constructors for class constraintconstraint constraint_v1 constraint_v2
Coskewness Matrix EstimatecoskewnessMF
Coskewness Matrix EstimatecoskewnessSF
Covariance Matrix EstimatecovarianceMF
Covariance Matrix EstimatecovarianceSF
create an efficient frontiercreate.EfficientFrontier
Compute returns mean vector and covariance matrix with custom.covRob.Mcdcustom.covRob.Mcd
Compute returns mean vector and covariance matrix with custom.covRob.MMcustom.covRob.MM
Compute returns mean vector and covariance matrix with custom.covRob.Rockecustom.covRob.Rocke
Compute returns mean vector and covariance matrix with custom.covRob.TSGScustom.covRob.TSGS
Function to compute diversification as a constraintdiversification
constructor for diversification_constraintdiversification_constraint
Entropy pooling program for blending views on scenarios with a prior scenario-probability distributionEntropyProg
Create an equal weight portfolioequal.weight
Minimum ETL MILP Optimizationetl_milp_opt
Minimum ETL LP Optimizationetl_opt
extract the risk value when knowing the weightsextract_risk
Cokurtosis EstimateextractCokurtosis
Coskewness EstimateextractCoskewness
Covariance EstimateextractCovariance
Extract the efficient frontier data pointsextractEfficientFrontier
Extract the group and/or category weightsextractGroups
Extract the objective measuresextractObjectiveMeasures
extract some stats and weights from a portfolio run via 'optimize.portfolio'extractStats extractStats.optimize.portfolio.DEoptim extractStats.optimize.portfolio.GenSA extractStats.optimize.portfolio.parallel extractStats.optimize.portfolio.pso extractStats.optimize.portfolio.random extractStats.optimize.portfolio.ROI
Extract weights from a portfolio run via 'optimize.portfolio' or 'optimize.portfolio.rebalancing'extractWeights
Constructor for factor exposure constraintfactor_exposure_constraint
mapping function to transform or penalize weights that violate constraintsfn_map
create a sequence of possible weights for random or brute force portfoliosgeneratesequence
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.get_constraints
GMV/QU QP Optimizationgmv_opt
GMV/QU QP Optimization with Turnover Constraintgmv_opt_leverage
GMV/QU QP Optimization with Proportional Transaction Cost Constraintgmv_opt_ptc
GMV/QU QP Optimization with Turnover Constraintgmv_opt_toc
constructor for group_constraintgroup_constraint
Test if group constraints have been violatedgroup_fail
Concentration of weightsHHI
Six Major Economic Indexesindexes
Insert a list of constraints into the constraints slot of a portfolio objectinsert_constraints
Insert a list of objectives into the objectives slot of a portfolio objectinsert_objectives
Create an inverse volatility weighted portfolioinverse.volatility.weight
check function for constraintsis.constraint
check class of an objective objectis.objective
check function for portfoliois.portfolio
constructor for leverage_exposure_constraintleverage_exposure_constraint
Maximum Return MILP Optimizationmaxret_milp_opt
Maximum Return LP Optimizationmaxret_opt
Generate the efficient frontier for a mean-CSM portfoliomeancsm.efficient.frontier
Generate the efficient frontier for a mean-etl portfoliomeanetl.efficient.frontier
Generate multiple efficient frontiers for the same portfoliomeanrisk.efficient.frontier
Generate the efficient frontier for a mean-variance portfoliomeanvar.efficient.frontier
Compute momentsmeucci.moments
Asset Rankingmeucci.ranking
constructor for class tmp_minmax_objectiveminmax_objective
Multple Layer Portfolio Specificationmult.portfolio.spec
Control settings for custom.covRob.McdMycovRobMcd
Control settings for custom.covRob.TSGSMycovRobTSGS
utility function to replace awkward named from unlistname.replace
constructor for class 'objective'objective
Optimal Portfolio Weights and Performance Valuesopt.outputMvo
Constrained optimization of portfoliosoptimize.portfolio optimize.portfolio_v1 optimize.portfolio_v2
Execute multiple optimize.portfolio calls, presumably in paralleloptimize.portfolio.parallel
Portfolio Optimization with Rebalancing Periodsoptimize.portfolio.rebalancing optimize.portfolio.rebalancing_v1
Generates histogrampHist
plot method for objects of class 'optimize.portfolio'plot.optimize.portfolio plot.optimize.portfolio.DEoptim plot.optimize.portfolio.GenSA plot.optimize.portfolio.pso plot.optimize.portfolio.random plot.optimize.portfolio.ROI
Generate efficient frontiers plot by providing frontiers.plotFrontiers
constructor for class portfolio_risk_objectiveportfolio_risk_objective
Portfolio Momentsportfolio.moments.bl
Portfolio Momentsportfolio.moments.boudt
constructor for class portfolioportfolio portfolio.spec
function to check for violation of position limits constraintspos_limit_fail
constructor for filter_constraintposition_limit_constraint
print method for constraint objectsprint.constraint
Print an efficient frontier objectprint.efficient.frontier
Printing output of optimize.portfolio.rebalancingprint.optimize.portfolio.rebalancing
Printing output of optimize.portfolioprint.optimize.portfolio.CVXR print.optimize.portfolio.DEoptim print.optimize.portfolio.GenSA print.optimize.portfolio.pso print.optimize.portfolio.random print.optimize.portfolio.ROI
Printing Portfolio Specification Objectsprint.portfolio
Printing summary output of optimize.portfolioprint.summary.optimize.portfolio
Printing summary output of optimize.portfolio.rebalancingprint.summary.optimize.portfolio.rebalancing
constructor for quadratic utility objectivequadratic_utility_objective
version 2 generate an arbitary number of constrained random portfoliosrandom_portfolios random_portfolios_v2
generate an arbitary number of constrained random portfoliosrandom_portfolios_v1
deprecated random portfolios wrapper until we write a random trades functionrandom_walk_portfolios
version 2 generate random permutations of a portfolio seed meeting your constraints on the weights of each assetrandomize_portfolio randomize_portfolio_v2
Random portfolio sample methodrandomize_portfolio_v1
Regime Portfoliosregime.portfolios
constructor for return_constraintreturn_constraint
constructor for class return_objectivereturn_objective
constructor for class risk_budget_objectiverisk_budget_objective
Generate random portfolios based on grid search methodrp_grid
Generate random portfolios using the sample methodrp_sample
Generate random portfolios using the simplex methodrp_simplex
Transform a weights vector to satisfy constraintsrp_transform
Apply a risk or return function to asset returnsscatterFUN
Portfolio Momentsset.portfolio.moments set.portfolio.moments_v2
set portfolio moments for use by lower level optimization functionsset.portfolio.moments_v1
Statistical Factor Modelstatistical.factor.model
Summarize an efficient frontier objectsummary.efficient.frontier
Summarizing output of optimize.portfoliosummary.optimize.portfolio
summary method for optimize.portfolio.rebalancingsummary.optimize.portfolio.rebalancing
Summarize Portfolio Specification Objectssummary.portfolio
apply a function over a configurable trailing periodtrailingFUN
constructor for transaction_cost_constrainttransaction_cost_constraint
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'turnover
constructor for turnover_constraintturnover_constraint
constructor for class turnover_objectiveturnover_objective
Helper function to update v1_constraint objects to v2 specification in the portfolio objectupdate_constraint_v1tov2
function for updating constrints, not well tested, may be brokenupdate.constraint
Calculate portfolio variancevar.portfolio
Constructor for weight concentration objectiveweight_concentration_objective
constructor for weight_sum_constraintweight_sum_constraint