From noreply at r-forge.r-project.org Sat Jan 3 23:51:41 2015 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 3 Jan 2015 23:51:41 +0100 (CET) Subject: [Returnanalytics-commits] r3578 - pkg/PerformanceAnalytics/sandbox Message-ID: <20150103225141.AD16218740F@r-forge.r-project.org> Author: peter_carl Date: 2015-01-03 23:51:41 +0100 (Sat, 03 Jan 2015) New Revision: 3578 Modified: pkg/PerformanceAnalytics/sandbox/howto-write-PA-functions.Rmd Log: - a bunch of good questions to answer about tests - thanks to Paul Teetor Modified: pkg/PerformanceAnalytics/sandbox/howto-write-PA-functions.Rmd =================================================================== --- pkg/PerformanceAnalytics/sandbox/howto-write-PA-functions.Rmd 2014-12-21 15:30:53 UTC (rev 3577) +++ pkg/PerformanceAnalytics/sandbox/howto-write-PA-functions.Rmd 2015-01-03 22:51:41 UTC (rev 3578) @@ -110,20 +110,14 @@ ## Learn how to ask good questions This might be your most important tool. -If you're having trouble, try to provide a small, reproducible example that someone can actually run on easily available data. If more complex data structures are required, `dump("x", file=stdout())` will print an expression that will recreate the object `x`. +If you're having trouble, try to provide a small, reproducible example that someone can actually run on easily available data. If more complex data structures are required, `dump("x", file=stdout())` will print an expression that will recreate your data object, `x`. -A good place to ask questions is the r-sig-finance mailing list, where the authors and several contributors to our packages are known to hang out: -https://stat.ethz.ch/mailman/listinfo/r-sig-finance -Before asking a question, make sure to read the posting guide -http://www.r-project.org/posting-guide.html -and then read Eric Raymond's essay: -http://www.catb.org/~esr/faqs/smart-questions.html +A good place to ask questions is the r-sig-finance mailing list, where the authors and several contributors to our packages are known to hang out. Sign up here: https://stat.ethz.ch/mailman/listinfo/r-sig-finance. Before asking a question, make sure to read the posting guide, found at: http://www.r-project.org/posting-guide.html. And then, for good measure, read Eric Raymond's essay on how to ask a good question in forums like these: http://www.catb.org/~esr/faqs/smart-questions.html. ## Make your life easier with RStudio Although RStudio is not required for contributing to `PerformanceAnalytics`, it is worth pointing out that it is a very capable IDE for R and has a number of tools for automating some of the workflow described above. Highly recommended. - # Writing Calculation Functions This section discusses some of the key principles that we've tried to adhere to when writing functions for `PerformanceAnalytics` in the belief that they help make the package easier for users to adopt into their work. With the principles in mind and tools in hand, we'll take a closer look at some specific examples. These examples won't be exhaustive or complete, so take a look at similar functions in the package for alternative methods as well. @@ -223,6 +217,8 @@ ## Handle missing data Calculations will be made with the appropriate handling for missing data. Contributors should not assume that users will provide complete or equal length data sets. If only equal length data sets are required for the calculation, users should be warned with a message describing how the data was truncated. +Be careful how you use `na.omit` on time series data. [add more here] + ## Warn the user when making assumptions If a function encounters an issue where there is a likely work-around to be applied or the function needs to make an assumption about what the user wants to do, the function should do so but inform the user by using `warning`. For example, in `Return.rebalancing` the function warns the user that it zero-filled any missing data that it encountered. ``` @@ -279,10 +275,14 @@ The `scale` variable is then set by how `xts` detects the data frequency. ## Use reclass for time series output - +One of the key reasons to use `xts` internally is that it handles conversion to and from other data classes. This allows us to accept a matrix, convert it to an xts object (assuming the row labels of the matrix are an identifiable date format), calculate something, and convert the result back to a matrix. The `xts::as.xts` conversion in `checkData` paired with the `xts::reclass` function provide the conversion. For example: ``` -result=reclass(result,match.to=R) -return(result) +foo <- function(R, ...) { + x = checkData(R) + result = x+1 # calculate something + result = reclass(result,match.to=R) # converts back to what the user provided + return(result) +} ``` ## Label outputs clearly @@ -295,8 +295,15 @@ In some cases, it is important to keep data pairs straight. For example, in functions where a set of returns and a set of benchmarks are possible inputs, individual results should be tagged with both the subject return name and the benchmark return name. ## Create good tests + Can we contribute unit tests? + Are unit tests required? + If so, what coverage do you expect? + In addition to checking for correct results, what errors or failures should I test for? + What unit testing framework do you use? + Can you please show me an example or skeleton of a unit test? + Where may I put my test data? + Do you really expect me to test charting functions? - ## How to pass functions and related arguments Example? the function is modify.args in quantstrat, in utils.R From noreply at r-forge.r-project.org Wed Jan 7 14:01:25 2015 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Wed, 7 Jan 2015 14:01:25 +0100 (CET) Subject: [Returnanalytics-commits] r3579 - in pkg/PerformanceAnalytics: . R Message-ID: <20150107130125.D0C1118786B@r-forge.r-project.org> Author: braverock Date: 2015-01-07 14:01:25 +0100 (Wed, 07 Jan 2015) New Revision: 3579 Modified: pkg/PerformanceAnalytics/DESCRIPTION pkg/PerformanceAnalytics/R/ActivePremium.R pkg/PerformanceAnalytics/R/AdjustedSharpeRatio.R pkg/PerformanceAnalytics/R/AppraisalRatio.R pkg/PerformanceAnalytics/R/BernadoLedoitratio.R pkg/PerformanceAnalytics/R/BurkeRatio.R pkg/PerformanceAnalytics/R/CAPM.alpha.R pkg/PerformanceAnalytics/R/CAPM.beta.R pkg/PerformanceAnalytics/R/CAPM.epsilon.R pkg/PerformanceAnalytics/R/CAPM.jensenAlpha.R pkg/PerformanceAnalytics/R/CAPM.utils.R pkg/PerformanceAnalytics/R/CalmarRatio.R pkg/PerformanceAnalytics/R/CoMoments.R pkg/PerformanceAnalytics/R/DRatio.R pkg/PerformanceAnalytics/R/DownsideDeviation.R pkg/PerformanceAnalytics/R/DownsideFrequency.R pkg/PerformanceAnalytics/R/DrawdownPeak.R pkg/PerformanceAnalytics/R/Drawdowns.R pkg/PerformanceAnalytics/R/ES.R pkg/PerformanceAnalytics/R/FamaBeta.R pkg/PerformanceAnalytics/R/Frequency.R pkg/PerformanceAnalytics/R/HerfindahlIndex.R pkg/PerformanceAnalytics/R/HurstIndex.R pkg/PerformanceAnalytics/R/InformationRatio.R pkg/PerformanceAnalytics/R/Kappa.R pkg/PerformanceAnalytics/R/KellyRatio.R pkg/PerformanceAnalytics/R/M2Sortino.R pkg/PerformanceAnalytics/R/MSquared.R pkg/PerformanceAnalytics/R/MSquaredExcess.R pkg/PerformanceAnalytics/R/MartinRatio.R pkg/PerformanceAnalytics/R/MeanAbsoluteDeviation.R pkg/PerformanceAnalytics/R/MultivariateMoments.R pkg/PerformanceAnalytics/R/NetSelectivity.R pkg/PerformanceAnalytics/R/Omega.R pkg/PerformanceAnalytics/R/OmegaExcessReturn.R pkg/PerformanceAnalytics/R/OmegaSharpeRatio.R pkg/PerformanceAnalytics/R/PainIndex.R pkg/PerformanceAnalytics/R/PainRatio.R pkg/PerformanceAnalytics/R/PortfolioRisk.R pkg/PerformanceAnalytics/R/ProspectRatio.R pkg/PerformanceAnalytics/R/Return.Geltner.R pkg/PerformanceAnalytics/R/Return.annualized.R pkg/PerformanceAnalytics/R/Return.calculate.R pkg/PerformanceAnalytics/R/Return.clean.R pkg/PerformanceAnalytics/R/Return.cumulative.R pkg/PerformanceAnalytics/R/Return.excess.R pkg/PerformanceAnalytics/R/Return.portfolio.R pkg/PerformanceAnalytics/R/Return.read.R pkg/PerformanceAnalytics/R/Return.relative.R pkg/PerformanceAnalytics/R/Selectivity.R pkg/PerformanceAnalytics/R/SemiDeviation.R pkg/PerformanceAnalytics/R/SharpeRatio.R pkg/PerformanceAnalytics/R/SharpeRatio.annualized.R pkg/PerformanceAnalytics/R/SkewnessKurtosisRatio.R pkg/PerformanceAnalytics/R/SmoothingIndex.R pkg/PerformanceAnalytics/R/SortinoRatio.R pkg/PerformanceAnalytics/R/SpecificRisk.R pkg/PerformanceAnalytics/R/StdDev.R pkg/PerformanceAnalytics/R/StdDev.annualized.R pkg/PerformanceAnalytics/R/SystematicRisk.R pkg/PerformanceAnalytics/R/TotalRisk.R pkg/PerformanceAnalytics/R/TrackingError.R pkg/PerformanceAnalytics/R/TreynorRatio.R pkg/PerformanceAnalytics/R/UlcerIndex.R pkg/PerformanceAnalytics/R/UpDownRatios.R pkg/PerformanceAnalytics/R/UpsideFrequency.R pkg/PerformanceAnalytics/R/UpsidePotentialRatio.R pkg/PerformanceAnalytics/R/UpsideRisk.R pkg/PerformanceAnalytics/R/VaR.Marginal.R pkg/PerformanceAnalytics/R/VaR.R pkg/PerformanceAnalytics/R/VolatilitySkewness.R pkg/PerformanceAnalytics/R/apply.fromstart.R pkg/PerformanceAnalytics/R/apply.rolling.R pkg/PerformanceAnalytics/R/chart.ACF.R pkg/PerformanceAnalytics/R/chart.ACFplus.R pkg/PerformanceAnalytics/R/chart.Bar.R pkg/PerformanceAnalytics/R/chart.BarVaR.R pkg/PerformanceAnalytics/R/chart.Boxplot.R pkg/PerformanceAnalytics/R/chart.CaptureRatios.R pkg/PerformanceAnalytics/R/chart.Correlation.R pkg/PerformanceAnalytics/R/chart.CumReturns.R pkg/PerformanceAnalytics/R/chart.Drawdown.R pkg/PerformanceAnalytics/R/chart.ECDF.R pkg/PerformanceAnalytics/R/chart.Events.R pkg/PerformanceAnalytics/R/chart.Histogram.R pkg/PerformanceAnalytics/R/chart.QQPlot.R pkg/PerformanceAnalytics/R/chart.Regression.R pkg/PerformanceAnalytics/R/chart.RelativePerformance.R pkg/PerformanceAnalytics/R/chart.RiskReturnScatter.R pkg/PerformanceAnalytics/R/chart.RollingCorrelation.R pkg/PerformanceAnalytics/R/chart.RollingMean.R pkg/PerformanceAnalytics/R/chart.RollingPerformance.R pkg/PerformanceAnalytics/R/chart.RollingQuantileRegression.R pkg/PerformanceAnalytics/R/chart.RollingRegression.R pkg/PerformanceAnalytics/R/chart.Scatter.R pkg/PerformanceAnalytics/R/chart.SnailTrail.R pkg/PerformanceAnalytics/R/chart.StackedBar.R pkg/PerformanceAnalytics/R/chart.TimeSeries.R pkg/PerformanceAnalytics/R/chart.VaRSensitivity.R pkg/PerformanceAnalytics/R/charts.Bar.R pkg/PerformanceAnalytics/R/charts.BarVaR.R pkg/PerformanceAnalytics/R/charts.PerformanceSummary.R pkg/PerformanceAnalytics/R/charts.RollingPerformance.R pkg/PerformanceAnalytics/R/charts.RollingRegression.R pkg/PerformanceAnalytics/R/charts.TimeSeries.R pkg/PerformanceAnalytics/R/checkData.R pkg/PerformanceAnalytics/R/findDrawdowns.R pkg/PerformanceAnalytics/R/kurtosis.R pkg/PerformanceAnalytics/R/legend.R pkg/PerformanceAnalytics/R/lpm.R pkg/PerformanceAnalytics/R/maxDrawdown.R pkg/PerformanceAnalytics/R/mean.utils.R pkg/PerformanceAnalytics/R/na.skip.R pkg/PerformanceAnalytics/R/replaceTabs.R pkg/PerformanceAnalytics/R/skewness.R pkg/PerformanceAnalytics/R/sortDrawdowns.R pkg/PerformanceAnalytics/R/table.AnnualizedReturns.R pkg/PerformanceAnalytics/R/table.Arbitrary.R pkg/PerformanceAnalytics/R/table.Autocorrelation.R pkg/PerformanceAnalytics/R/table.CAPM.R pkg/PerformanceAnalytics/R/table.CalendarReturns.R pkg/PerformanceAnalytics/R/table.CaptureRatios.R pkg/PerformanceAnalytics/R/table.Correlation.R pkg/PerformanceAnalytics/R/table.Distributions.R pkg/PerformanceAnalytics/R/table.DownsideRisk.R pkg/PerformanceAnalytics/R/table.DownsideRiskRatio.R pkg/PerformanceAnalytics/R/table.Drawdowns.R pkg/PerformanceAnalytics/R/table.DrawdownsRatio.R pkg/PerformanceAnalytics/R/table.HigherMoments.R pkg/PerformanceAnalytics/R/table.InformationRatio.R pkg/PerformanceAnalytics/R/table.MonthlyReturns.R pkg/PerformanceAnalytics/R/table.RollingPeriods.R pkg/PerformanceAnalytics/R/table.SpecificRisk.R pkg/PerformanceAnalytics/R/table.UpDownRatios.R pkg/PerformanceAnalytics/R/table.Variability.R pkg/PerformanceAnalytics/R/textplot.R pkg/PerformanceAnalytics/R/zerofill.R pkg/PerformanceAnalytics/R/zzz.R Log: - update Copyright to 2015 Modified: pkg/PerformanceAnalytics/DESCRIPTION =================================================================== --- pkg/PerformanceAnalytics/DESCRIPTION 2015-01-03 22:51:41 UTC (rev 3578) +++ pkg/PerformanceAnalytics/DESCRIPTION 2015-01-07 13:01:25 UTC (rev 3579) @@ -12,7 +12,7 @@ , person(given="Kyle",family="Balkissoon",role="ctb") , person(given="Diethelm",family="Wuertz",role="ctb") ) -Version: 1.4.3574 +Version: 1.4.3579 Date: $Date$ Description: Collection of econometric functions for performance and risk analysis. This package aims to aid @@ -38,4 +38,4 @@ gplots License: GPL-2 | GPL-3 URL: http://r-forge.r-project.org/projects/returnanalytics/ -Copyright: (c) 2004-2014 +Copyright: (c) 2004-2015 Modified: pkg/PerformanceAnalytics/R/ActivePremium.R =================================================================== --- pkg/PerformanceAnalytics/R/ActivePremium.R 2015-01-03 22:51:41 UTC (rev 3578) +++ pkg/PerformanceAnalytics/R/ActivePremium.R 2015-01-07 13:01:25 UTC (rev 3579) @@ -77,7 +77,7 @@ ############################################################################### # R (http://r-project.org/) Econometrics for Performance and Risk Analysis # -# Copyright (c) 2004-2014 Peter Carl and Brian G. Peterson +# Copyright (c) 2004-2015 Peter Carl and Brian G. Peterson # # This R package is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PerformanceAnalytics/R/AdjustedSharpeRatio.R =================================================================== --- pkg/PerformanceAnalytics/R/AdjustedSharpeRatio.R 2015-01-03 22:51:41 UTC (rev 3578) +++ pkg/PerformanceAnalytics/R/AdjustedSharpeRatio.R 2015-01-07 13:01:25 UTC (rev 3579) @@ -67,7 +67,7 @@ ############################################################################### # R (http://r-project.org/) Econometrics for Performance and Risk Analysis # -# Copyright (c) 2004-2014 Peter Carl and Brian G. Peterson +# Copyright (c) 2004-2015 Peter Carl and Brian G. Peterson # # This R package is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PerformanceAnalytics/R/AppraisalRatio.R =================================================================== --- pkg/PerformanceAnalytics/R/AppraisalRatio.R 2015-01-03 22:51:41 UTC (rev 3578) +++ pkg/PerformanceAnalytics/R/AppraisalRatio.R 2015-01-07 13:01:25 UTC (rev 3579) @@ -94,7 +94,7 @@ ############################################################################### # R (http://r-project.org/) Econometrics for Performance and Risk Analysis # -# Copyright (c) 2004-2014 Peter Carl and Brian G. Peterson +# Copyright (c) 2004-2015 Peter Carl and Brian G. Peterson # # This R package is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PerformanceAnalytics/R/BernadoLedoitratio.R =================================================================== --- pkg/PerformanceAnalytics/R/BernadoLedoitratio.R 2015-01-03 22:51:41 UTC (rev 3578) +++ pkg/PerformanceAnalytics/R/BernadoLedoitratio.R 2015-01-07 13:01:25 UTC (rev 3579) @@ -49,7 +49,7 @@ ############################################################################### # R (http://r-project.org/) Econometrics for Performance and Risk Analysis # -# Copyright (c) 2004-2014 Peter Carl and Brian G. Peterson +# Copyright (c) 2004-2015 Peter Carl and Brian G. Peterson # # This R package is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PerformanceAnalytics/R/BurkeRatio.R =================================================================== --- pkg/PerformanceAnalytics/R/BurkeRatio.R 2015-01-03 22:51:41 UTC (rev 3578) +++ pkg/PerformanceAnalytics/R/BurkeRatio.R 2015-01-07 13:01:25 UTC (rev 3579) @@ -129,7 +129,7 @@ ############################################################################### # R (http://r-project.org/) Econometrics for Performance and Risk Analysis # -# Copyright (c) 2004-2014 Peter Carl and Brian G. Peterson +# Copyright (c) 2004-2015 Peter Carl and Brian G. Peterson # # This R package is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PerformanceAnalytics/R/CAPM.alpha.R =================================================================== --- pkg/PerformanceAnalytics/R/CAPM.alpha.R 2015-01-03 22:51:41 UTC (rev 3578) +++ pkg/PerformanceAnalytics/R/CAPM.alpha.R 2015-01-07 13:01:25 UTC (rev 3579) @@ -100,7 +100,7 @@ ############################################################################### # R (http://r-project.org/) Econometrics for Performance and Risk Analysis # -# Copyright (c) 2004-2014 Peter Carl and Brian G. Peterson +# Copyright (c) 2004-2015 Peter Carl and Brian G. Peterson # # This R package is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PerformanceAnalytics/R/CAPM.beta.R =================================================================== --- pkg/PerformanceAnalytics/R/CAPM.beta.R 2015-01-03 22:51:41 UTC (rev 3578) +++ pkg/PerformanceAnalytics/R/CAPM.beta.R 2015-01-07 13:01:25 UTC (rev 3579) @@ -264,7 +264,7 @@ ############################################################################### # R (http://r-project.org/) Econometrics for Performance and Risk Analysis # -# Copyright (c) 2004-2014 Peter Carl and Brian G. Peterson +# Copyright (c) 2004-2015 Peter Carl and Brian G. Peterson # # This R package is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PerformanceAnalytics/R/CAPM.epsilon.R =================================================================== --- pkg/PerformanceAnalytics/R/CAPM.epsilon.R 2015-01-03 22:51:41 UTC (rev 3578) +++ pkg/PerformanceAnalytics/R/CAPM.epsilon.R 2015-01-07 13:01:25 UTC (rev 3579) @@ -71,7 +71,7 @@ ############################################################################### # R (http://r-project.org/) Econometrics for Performance and Risk Analysis # -# Copyright (c) 2004-2014 Peter Carl and Brian G. Peterson +# Copyright (c) 2004-2015 Peter Carl and Brian G. Peterson # # This R package is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PerformanceAnalytics/R/CAPM.jensenAlpha.R =================================================================== --- pkg/PerformanceAnalytics/R/CAPM.jensenAlpha.R 2015-01-03 22:51:41 UTC (rev 3578) +++ pkg/PerformanceAnalytics/R/CAPM.jensenAlpha.R 2015-01-07 13:01:25 UTC (rev 3579) @@ -71,7 +71,7 @@ ############################################################################### # R (http://r-project.org/) Econometrics for Performance and Risk Analysis # -# Copyright (c) 2004-2014 Peter Carl and Brian G. Peterson +# Copyright (c) 2004-2015 Peter Carl and Brian G. Peterson # # This R package is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PerformanceAnalytics/R/CAPM.utils.R =================================================================== --- pkg/PerformanceAnalytics/R/CAPM.utils.R 2015-01-03 22:51:41 UTC (rev 3578) +++ pkg/PerformanceAnalytics/R/CAPM.utils.R 2015-01-07 13:01:25 UTC (rev 3579) @@ -161,7 +161,7 @@ ############################################################################### # R (http://r-project.org/) Econometrics for Performance and Risk Analysis # -# Copyright (c) 2004-2014 Peter Carl and Brian G. Peterson +# Copyright (c) 2004-2015 Peter Carl and Brian G. Peterson # # This R package is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PerformanceAnalytics/R/CalmarRatio.R =================================================================== --- pkg/PerformanceAnalytics/R/CalmarRatio.R 2015-01-03 22:51:41 UTC (rev 3578) +++ pkg/PerformanceAnalytics/R/CalmarRatio.R 2015-01-07 13:01:25 UTC (rev 3579) @@ -119,7 +119,7 @@ ############################################################################### # R (http://r-project.org/) Econometrics for Performance and Risk Analysis # -# Copyright (c) 2004-2014 Peter Carl and Brian G. Peterson +# Copyright (c) 2004-2015 Peter Carl and Brian G. Peterson # # This R package is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PerformanceAnalytics/R/CoMoments.R =================================================================== --- pkg/PerformanceAnalytics/R/CoMoments.R 2015-01-03 22:51:41 UTC (rev 3578) +++ pkg/PerformanceAnalytics/R/CoMoments.R 2015-01-07 13:01:25 UTC (rev 3579) @@ -518,7 +518,7 @@ ############################################################################### # R (http://r-project.org/) Econometrics for Performance and Risk Analysis # -# Copyright (c) 2004-2014 Peter Carl and Brian G. Peterson +# Copyright (c) 2004-2015 Peter Carl and Brian G. Peterson # # This R package is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PerformanceAnalytics/R/DRatio.R =================================================================== --- pkg/PerformanceAnalytics/R/DRatio.R 2015-01-03 22:51:41 UTC (rev 3578) +++ pkg/PerformanceAnalytics/R/DRatio.R 2015-01-07 13:01:25 UTC (rev 3579) @@ -60,7 +60,7 @@ ############################################################################### # R (http://r-project.org/) Econometrics for Performance and Risk Analysis # -# Copyright (c) 2004-2014 Peter Carl and Brian G. Peterson +# Copyright (c) 2004-2015 Peter Carl and Brian G. Peterson # # This R package is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PerformanceAnalytics/R/DownsideDeviation.R =================================================================== --- pkg/PerformanceAnalytics/R/DownsideDeviation.R 2015-01-03 22:51:41 UTC (rev 3578) +++ pkg/PerformanceAnalytics/R/DownsideDeviation.R 2015-01-07 13:01:25 UTC (rev 3579) @@ -188,7 +188,7 @@ ############################################################################### # R (http://r-project.org/) Econometrics for Performance and Risk Analysis # -# Copyright (c) 2004-2014 Peter Carl and Brian G. Peterson +# Copyright (c) 2004-2015 Peter Carl and Brian G. Peterson # # This R package is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PerformanceAnalytics/R/DownsideFrequency.R =================================================================== --- pkg/PerformanceAnalytics/R/DownsideFrequency.R 2015-01-03 22:51:41 UTC (rev 3578) +++ pkg/PerformanceAnalytics/R/DownsideFrequency.R 2015-01-07 13:01:25 UTC (rev 3579) @@ -64,7 +64,7 @@ ############################################################################### # R (http://r-project.org/) Econometrics for Performance and Risk Analysis # -# Copyright (c) 2004-2014 Peter Carl and Brian G. Peterson +# Copyright (c) 2004-2015 Peter Carl and Brian G. Peterson # # This R package is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PerformanceAnalytics/R/DrawdownPeak.R =================================================================== --- pkg/PerformanceAnalytics/R/DrawdownPeak.R 2015-01-03 22:51:41 UTC (rev 3578) +++ pkg/PerformanceAnalytics/R/DrawdownPeak.R 2015-01-07 13:01:25 UTC (rev 3579) @@ -63,7 +63,7 @@ ############################################################################### # R (http://r-project.org/) Econometrics for Performance and Risk Analysis # -# Copyright (c) 2004-2014 Peter Carl and Brian G. Peterson +# Copyright (c) 2004-2015 Peter Carl and Brian G. Peterson # # This R package is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PerformanceAnalytics/R/Drawdowns.R =================================================================== --- pkg/PerformanceAnalytics/R/Drawdowns.R 2015-01-03 22:51:41 UTC (rev 3578) +++ pkg/PerformanceAnalytics/R/Drawdowns.R 2015-01-07 13:01:25 UTC (rev 3579) @@ -39,7 +39,7 @@ ############################################################################### # R (http://r-project.org/) Econometrics for Performance and Risk Analysis # -# Copyright (c) 2004-2014 Peter Carl and Brian G. Peterson +# Copyright (c) 2004-2015 Peter Carl and Brian G. Peterson # # This R package is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PerformanceAnalytics/R/ES.R =================================================================== --- pkg/PerformanceAnalytics/R/ES.R 2015-01-03 22:51:41 UTC (rev 3578) +++ pkg/PerformanceAnalytics/R/ES.R 2015-01-07 13:01:25 UTC (rev 3579) @@ -236,7 +236,7 @@ ############################################################################### # R (http://r-project.org/) Econometrics for Performance and Risk Analysis # -# Copyright (c) 2004-2014 Peter Carl and Brian G. Peterson +# Copyright (c) 2004-2015 Peter Carl and Brian G. Peterson # # This R package is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PerformanceAnalytics/R/FamaBeta.R =================================================================== --- pkg/PerformanceAnalytics/R/FamaBeta.R 2015-01-03 22:51:41 UTC (rev 3578) +++ pkg/PerformanceAnalytics/R/FamaBeta.R 2015-01-07 13:01:25 UTC (rev 3579) @@ -68,7 +68,7 @@ ############################################################################### # R (http://r-project.org/) Econometrics for Performance and Risk Analysis # -# Copyright (c) 2004-2014 Peter Carl and Brian G. Peterson +# Copyright (c) 2004-2015 Peter Carl and Brian G. Peterson # # This R package is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PerformanceAnalytics/R/Frequency.R =================================================================== --- pkg/PerformanceAnalytics/R/Frequency.R 2015-01-03 22:51:41 UTC (rev 3578) +++ pkg/PerformanceAnalytics/R/Frequency.R 2015-01-07 13:01:25 UTC (rev 3579) @@ -60,7 +60,7 @@ ############################################################################### # R (http://r-project.org/) Econometrics for Performance and Risk Analysis # -# Copyright (c) 2004-2014 Peter Carl and Brian G. Peterson +# Copyright (c) 2004-2015 Peter Carl and Brian G. Peterson # # This R package is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PerformanceAnalytics/R/HerfindahlIndex.R =================================================================== --- pkg/PerformanceAnalytics/R/HerfindahlIndex.R 2015-01-03 22:51:41 UTC (rev 3578) +++ pkg/PerformanceAnalytics/R/HerfindahlIndex.R 2015-01-07 13:01:25 UTC (rev 3579) @@ -28,7 +28,7 @@ ############################################################################### # R (http://r-project.org/) Econometrics for Performance and Risk Analysis # -# Copyright (c) 2004-2014 Peter Carl and Brian G. Peterson +# Copyright (c) 2004-2015 Peter Carl and Brian G. Peterson # # This R package is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PerformanceAnalytics/R/HurstIndex.R =================================================================== --- pkg/PerformanceAnalytics/R/HurstIndex.R 2015-01-03 22:51:41 UTC (rev 3578) +++ pkg/PerformanceAnalytics/R/HurstIndex.R 2015-01-07 13:01:25 UTC (rev 3579) @@ -70,7 +70,7 @@ ############################################################################### # R (http://r-project.org/) Econometrics for Performance and Risk Analysis # -# Copyright (c) 2004-2014 Peter Carl and Brian G. Peterson +# Copyright (c) 2004-2015 Peter Carl and Brian G. Peterson # # This R package is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PerformanceAnalytics/R/InformationRatio.R =================================================================== --- pkg/PerformanceAnalytics/R/InformationRatio.R 2015-01-03 22:51:41 UTC (rev 3578) +++ pkg/PerformanceAnalytics/R/InformationRatio.R 2015-01-07 13:01:25 UTC (rev 3579) @@ -81,7 +81,7 @@ ############################################################################### # R (http://r-project.org/) Econometrics for Performance and Risk Analysis # -# Copyright (c) 2004-2014 Peter Carl and Brian G. Peterson +# Copyright (c) 2004-2015 Peter Carl and Brian G. Peterson # # This R package is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PerformanceAnalytics/R/Kappa.R =================================================================== --- pkg/PerformanceAnalytics/R/Kappa.R 2015-01-03 22:51:41 UTC (rev 3578) +++ pkg/PerformanceAnalytics/R/Kappa.R 2015-01-07 13:01:25 UTC (rev 3579) @@ -73,7 +73,7 @@ ############################################################################### # R (http://r-project.org/) Econometrics for Performance and Risk Analysis # -# Copyright (c) 2004-2014 Peter Carl and Brian G. Peterson +# Copyright (c) 2004-2015 Peter Carl and Brian G. Peterson # # This R package is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PerformanceAnalytics/R/KellyRatio.R =================================================================== --- pkg/PerformanceAnalytics/R/KellyRatio.R 2015-01-03 22:51:41 UTC (rev 3578) +++ pkg/PerformanceAnalytics/R/KellyRatio.R 2015-01-07 13:01:25 UTC (rev 3579) @@ -74,7 +74,7 @@ ############################################################################### # R (http://r-project.org/) Econometrics for Performance and Risk Analysis # -# Copyright (c) 2004-2014 Peter Carl and Brian G. Peterson +# Copyright (c) 2004-2015 Peter Carl and Brian G. Peterson # # This R package is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PerformanceAnalytics/R/M2Sortino.R =================================================================== --- pkg/PerformanceAnalytics/R/M2Sortino.R 2015-01-03 22:51:41 UTC (rev 3578) +++ pkg/PerformanceAnalytics/R/M2Sortino.R 2015-01-07 13:01:25 UTC (rev 3579) @@ -72,7 +72,7 @@ ############################################################################### # R (http://r-project.org/) Econometrics for Performance and Risk Analysis # -# Copyright (c) 2004-2014 Peter Carl and Brian G. Peterson +# Copyright (c) 2004-2015 Peter Carl and Brian G. Peterson # # This R package is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PerformanceAnalytics/R/MSquared.R =================================================================== --- pkg/PerformanceAnalytics/R/MSquared.R 2015-01-03 22:51:41 UTC (rev 3578) +++ pkg/PerformanceAnalytics/R/MSquared.R 2015-01-07 13:01:25 UTC (rev 3579) @@ -69,7 +69,7 @@ ############################################################################### # R (http://r-project.org/) Econometrics for Performance and Risk Analysis # -# Copyright (c) 2004-2014 Peter Carl and Brian G. Peterson +# Copyright (c) 2004-2015 Peter Carl and Brian G. Peterson # # This R package is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PerformanceAnalytics/R/MSquaredExcess.R =================================================================== --- pkg/PerformanceAnalytics/R/MSquaredExcess.R 2015-01-03 22:51:41 UTC (rev 3578) +++ pkg/PerformanceAnalytics/R/MSquaredExcess.R 2015-01-07 13:01:25 UTC (rev 3579) @@ -75,7 +75,7 @@ ############################################################################### # R (http://r-project.org/) Econometrics for Performance and Risk Analysis # -# Copyright (c) 2004-2014 Peter Carl and Brian G. Peterson +# Copyright (c) 2004-2015 Peter Carl and Brian G. Peterson # # This R package is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PerformanceAnalytics/R/MartinRatio.R =================================================================== --- pkg/PerformanceAnalytics/R/MartinRatio.R 2015-01-03 22:51:41 UTC (rev 3578) +++ pkg/PerformanceAnalytics/R/MartinRatio.R 2015-01-07 13:01:25 UTC (rev 3579) @@ -66,7 +66,7 @@ ############################################################################### # R (http://r-project.org/) Econometrics for Performance and Risk Analysis # -# Copyright (c) 2004-2014 Peter Carl and Brian G. Peterson +# Copyright (c) 2004-2015 Peter Carl and Brian G. Peterson # # This R package is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PerformanceAnalytics/R/MeanAbsoluteDeviation.R =================================================================== --- pkg/PerformanceAnalytics/R/MeanAbsoluteDeviation.R 2015-01-03 22:51:41 UTC (rev 3578) +++ pkg/PerformanceAnalytics/R/MeanAbsoluteDeviation.R 2015-01-07 13:01:25 UTC (rev 3579) @@ -47,7 +47,7 @@ ############################################################################### # R (http://r-project.org/) Econometrics for Performance and Risk Analysis # -# Copyright (c) 2004-2014 Peter Carl and Brian G. Peterson +# Copyright (c) 2004-2015 Peter Carl and Brian G. Peterson # # This R package is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PerformanceAnalytics/R/MultivariateMoments.R =================================================================== --- pkg/PerformanceAnalytics/R/MultivariateMoments.R 2015-01-03 22:51:41 UTC (rev 3578) +++ pkg/PerformanceAnalytics/R/MultivariateMoments.R 2015-01-07 13:01:25 UTC (rev 3579) @@ -8,7 +8,7 @@ # efficient when running against very large numbers of instruments or portfolios. # # Copyright (c) 2008 Kris Boudt and Brian G. Peterson -# Copyright (c) 2004-2014 Peter Carl and Brian G. Peterson for PerformanceAnalytics +# Copyright (c) 2004-2015 Peter Carl and Brian G. Peterson for PerformanceAnalytics # This R package is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING ############################################################################### @@ -201,7 +201,7 @@ ############################################################################### # R (http://r-project.org/) Econometrics for Performance and Risk Analysis # -# Copyright (c) 2004-2014 Peter Carl and Brian G. Peterson and Kris Boudt +# Copyright (c) 2004-2015 Peter Carl and Brian G. Peterson and Kris Boudt # # This R package is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PerformanceAnalytics/R/NetSelectivity.R =================================================================== --- pkg/PerformanceAnalytics/R/NetSelectivity.R 2015-01-03 22:51:41 UTC (rev 3578) +++ pkg/PerformanceAnalytics/R/NetSelectivity.R 2015-01-07 13:01:25 UTC (rev 3579) @@ -71,7 +71,7 @@ ############################################################################### # R (http://r-project.org/) Econometrics for Performance and Risk Analysis # -# Copyright (c) 2004-2014 Peter Carl and Brian G. Peterson +# Copyright (c) 2004-2015 Peter Carl and Brian G. Peterson # # This R package is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PerformanceAnalytics/R/Omega.R =================================================================== --- pkg/PerformanceAnalytics/R/Omega.R 2015-01-03 22:51:41 UTC (rev 3578) +++ pkg/PerformanceAnalytics/R/Omega.R 2015-01-07 13:01:25 UTC (rev 3579) @@ -184,7 +184,7 @@ ############################################################################### # R (http://r-project.org/) Econometrics for Performance and Risk Analysis # -# Copyright (c) 2004-2014 Peter Carl and Brian G. Peterson +# Copyright (c) 2004-2015 Peter Carl and Brian G. Peterson # # This R package is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PerformanceAnalytics/R/OmegaExcessReturn.R =================================================================== --- pkg/PerformanceAnalytics/R/OmegaExcessReturn.R 2015-01-03 22:51:41 UTC (rev 3578) +++ pkg/PerformanceAnalytics/R/OmegaExcessReturn.R 2015-01-07 13:01:25 UTC (rev 3579) @@ -73,7 +73,7 @@ ############################################################################### # R (http://r-project.org/) Econometrics for Performance and Risk Analysis # -# Copyright (c) 2004-2014 Peter Carl and Brian G. Peterson +# Copyright (c) 2004-2015 Peter Carl and Brian G. Peterson # # This R package is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PerformanceAnalytics/R/OmegaSharpeRatio.R =================================================================== --- pkg/PerformanceAnalytics/R/OmegaSharpeRatio.R 2015-01-03 22:51:41 UTC (rev 3578) +++ pkg/PerformanceAnalytics/R/OmegaSharpeRatio.R 2015-01-07 13:01:25 UTC (rev 3579) @@ -78,7 +78,7 @@ ############################################################################### # R (http://r-project.org/) Econometrics for Performance and Risk Analysis # -# Copyright (c) 2004-2014 Peter Carl and Brian G. Peterson +# Copyright (c) 2004-2015 Peter Carl and Brian G. Peterson # # This R package is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PerformanceAnalytics/R/PainIndex.R =================================================================== --- pkg/PerformanceAnalytics/R/PainIndex.R 2015-01-03 22:51:41 UTC (rev 3578) +++ pkg/PerformanceAnalytics/R/PainIndex.R 2015-01-07 13:01:25 UTC (rev 3579) @@ -64,7 +64,7 @@ ############################################################################### # R (http://r-project.org/) Econometrics for Performance and Risk Analysis # -# Copyright (c) 2004-2014 Peter Carl and Brian G. Peterson +# Copyright (c) 2004-2015 Peter Carl and Brian G. Peterson # # This R package is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PerformanceAnalytics/R/PainRatio.R =================================================================== --- pkg/PerformanceAnalytics/R/PainRatio.R 2015-01-03 22:51:41 UTC (rev 3578) +++ pkg/PerformanceAnalytics/R/PainRatio.R 2015-01-07 13:01:25 UTC (rev 3579) @@ -66,7 +66,7 @@ ############################################################################### # R (http://r-project.org/) Econometrics for Performance and Risk Analysis # -# Copyright (c) 2004-2014 Peter Carl and Brian G. Peterson +# Copyright (c) 2004-2015 Peter Carl and Brian G. Peterson # # This R package is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PerformanceAnalytics/R/PortfolioRisk.R =================================================================== --- pkg/PerformanceAnalytics/R/PortfolioRisk.R 2015-01-03 22:51:41 UTC (rev 3578) +++ pkg/PerformanceAnalytics/R/PortfolioRisk.R 2015-01-07 13:01:25 UTC (rev 3579) @@ -621,7 +621,7 @@ ############################################################################### # R (http://r-project.org/) Econometrics for Performance and Risk Analysis # -# Copyright (c) 2004-2014 Peter Carl and Brian G. Peterson and Kris Boudt +# Copyright (c) 2004-2015 Peter Carl and Brian G. Peterson and Kris Boudt # # This R package is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PerformanceAnalytics/R/ProspectRatio.R =================================================================== --- pkg/PerformanceAnalytics/R/ProspectRatio.R 2015-01-03 22:51:41 UTC (rev 3578) +++ pkg/PerformanceAnalytics/R/ProspectRatio.R 2015-01-07 13:01:25 UTC (rev 3579) @@ -66,7 +66,7 @@ ############################################################################### # R (http://r-project.org/) Econometrics for Performance and Risk Analysis # -# Copyright (c) 2004-2014 Peter Carl and Brian G. Peterson +# Copyright (c) 2004-2015 Peter Carl and Brian G. Peterson # # This R package is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PerformanceAnalytics/R/Return.Geltner.R =================================================================== --- pkg/PerformanceAnalytics/R/Return.Geltner.R 2015-01-03 22:51:41 UTC (rev 3578) +++ pkg/PerformanceAnalytics/R/Return.Geltner.R 2015-01-07 13:01:25 UTC (rev 3579) @@ -84,7 +84,7 @@ ############################################################################### # R (http://r-project.org/) Econometrics for Performance and Risk Analysis # -# Copyright (c) 2004-2014 Peter Carl and Brian G. Peterson +# Copyright (c) 2004-2015 Peter Carl and Brian G. Peterson # # This R package is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PerformanceAnalytics/R/Return.annualized.R =================================================================== --- pkg/PerformanceAnalytics/R/Return.annualized.R 2015-01-03 22:51:41 UTC (rev 3578) +++ pkg/PerformanceAnalytics/R/Return.annualized.R 2015-01-07 13:01:25 UTC (rev 3579) @@ -97,7 +97,7 @@ ############################################################################### # R (http://r-project.org/) Econometrics for Performance and Risk Analysis # -# Copyright (c) 2004-2014 Peter Carl and Brian G. Peterson +# Copyright (c) 2004-2015 Peter Carl and Brian G. Peterson # # This R package is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PerformanceAnalytics/R/Return.calculate.R =================================================================== --- pkg/PerformanceAnalytics/R/Return.calculate.R 2015-01-03 22:51:41 UTC (rev 3578) +++ pkg/PerformanceAnalytics/R/Return.calculate.R 2015-01-07 13:01:25 UTC (rev 3579) @@ -91,7 +91,7 @@ ############################################################################### # R (http://r-project.org/) Econometrics for Performance and Risk Analysis # -# Copyright (c) 2004-2014 Peter Carl and Brian G. Peterson +# Copyright (c) 2004-2015 Peter Carl and Brian G. Peterson # # This R package is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PerformanceAnalytics/R/Return.clean.R =================================================================== --- pkg/PerformanceAnalytics/R/Return.clean.R 2015-01-03 22:51:41 UTC (rev 3578) +++ pkg/PerformanceAnalytics/R/Return.clean.R 2015-01-07 13:01:25 UTC (rev 3579) @@ -258,7 +258,7 @@ ############################################################################### # R (http://r-project.org/) Econometrics for Performance and Risk Analysis # -# Copyright (c) 2004-2014 Peter Carl and Brian G. Peterson +# Copyright (c) 2004-2015 Peter Carl and Brian G. Peterson # # This R package is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PerformanceAnalytics/R/Return.cumulative.R =================================================================== --- pkg/PerformanceAnalytics/R/Return.cumulative.R 2015-01-03 22:51:41 UTC (rev 3578) +++ pkg/PerformanceAnalytics/R/Return.cumulative.R 2015-01-07 13:01:25 UTC (rev 3579) @@ -52,7 +52,7 @@ ############################################################################### # R (http://r-project.org/) Econometrics for Performance and Risk Analysis # -# Copyright (c) 2004-2014 Peter Carl and Brian G. Peterson +# Copyright (c) 2004-2015 Peter Carl and Brian G. Peterson # # This R package is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PerformanceAnalytics/R/Return.excess.R =================================================================== --- pkg/PerformanceAnalytics/R/Return.excess.R 2015-01-03 22:51:41 UTC (rev 3578) +++ pkg/PerformanceAnalytics/R/Return.excess.R 2015-01-07 13:01:25 UTC (rev 3579) @@ -94,7 +94,7 @@ ############################################################################### # R (http://r-project.org/) Econometrics for Performance and Risk Analysis # -# Copyright (c) 2004-2014 Peter Carl and Brian G. Peterson +# Copyright (c) 2004-2015 Peter Carl and Brian G. Peterson # # This R package is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PerformanceAnalytics/R/Return.portfolio.R =================================================================== --- pkg/PerformanceAnalytics/R/Return.portfolio.R 2015-01-03 22:51:41 UTC (rev 3578) [TRUNCATED] To get the complete diff run: svnlook diff /svnroot/returnanalytics -r 3579 From noreply at r-forge.r-project.org Wed Jan 7 14:04:56 2015 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Wed, 7 Jan 2015 14:04:56 +0100 (CET) Subject: [Returnanalytics-commits] r3580 - pkg/PerformanceAnalytics Message-ID: <20150107130456.AB746183B95@r-forge.r-project.org> Author: braverock Date: 2015-01-07 14:04:56 +0100 (Wed, 07 Jan 2015) New Revision: 3580 Modified: pkg/PerformanceAnalytics/codeblock.txt Log: - update Copyright to 2015 Modified: pkg/PerformanceAnalytics/codeblock.txt =================================================================== --- pkg/PerformanceAnalytics/codeblock.txt 2015-01-07 13:01:25 UTC (rev 3579) +++ pkg/PerformanceAnalytics/codeblock.txt 2015-01-07 13:04:56 UTC (rev 3580) @@ -3,7 +3,7 @@ ############################################################################### # R (http://r-project.org/) Econometrics for Performance and Risk Analysis # -# Copyright (c) 2004-2014 Peter Carl and Brian G. Peterson +# Copyright (c) 2004-2015 Peter Carl and Brian G. Peterson # # This R package is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING From noreply at r-forge.r-project.org Wed Jan 7 14:12:50 2015 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Wed, 7 Jan 2015 14:12:50 +0100 (CET) Subject: [Returnanalytics-commits] r3581 - in pkg/PortfolioAnalytics: . R demo man sandbox Message-ID: <20150107131250.375E3184F4D@r-forge.r-project.org> Author: braverock Date: 2015-01-07 14:12:49 +0100 (Wed, 07 Jan 2015) New Revision: 3581 Removed: pkg/PortfolioAnalytics/man/constraint_ROI.Rd Modified: pkg/PortfolioAnalytics/DESCRIPTION pkg/PortfolioAnalytics/R/applyFUN.R pkg/PortfolioAnalytics/R/chart.RiskReward.R pkg/PortfolioAnalytics/R/chart.Weights.R pkg/PortfolioAnalytics/R/charts.DE.R pkg/PortfolioAnalytics/R/charts.GenSA.R pkg/PortfolioAnalytics/R/charts.PSO.R pkg/PortfolioAnalytics/R/charts.ROI.R pkg/PortfolioAnalytics/R/charts.RP.R pkg/PortfolioAnalytics/R/charts.efficient.frontier.R pkg/PortfolioAnalytics/R/charts.groups.R pkg/PortfolioAnalytics/R/charts.multiple.R pkg/PortfolioAnalytics/R/charts.risk.R pkg/PortfolioAnalytics/R/constrained_objective.R pkg/PortfolioAnalytics/R/constraint_fn_map.R pkg/PortfolioAnalytics/R/constraints.R pkg/PortfolioAnalytics/R/constraintsFUN.R pkg/PortfolioAnalytics/R/constraints_ROI.R pkg/PortfolioAnalytics/R/equal.weight.R pkg/PortfolioAnalytics/R/extract.efficient.frontier.R pkg/PortfolioAnalytics/R/extractstats.R pkg/PortfolioAnalytics/R/generics.R pkg/PortfolioAnalytics/R/inverse.volatility.weight.R pkg/PortfolioAnalytics/R/moment.functions.R pkg/PortfolioAnalytics/R/objective.R pkg/PortfolioAnalytics/R/objectiveFUN.R pkg/PortfolioAnalytics/R/optFUN.R pkg/PortfolioAnalytics/R/optimize.portfolio.R pkg/PortfolioAnalytics/R/portfolio.R pkg/PortfolioAnalytics/R/random_portfolios.R pkg/PortfolioAnalytics/R/stat.factor.model.R pkg/PortfolioAnalytics/R/trailingFUN.R pkg/PortfolioAnalytics/R/utility.combine.R pkg/PortfolioAnalytics/R/utils.R pkg/PortfolioAnalytics/codeblock.txt pkg/PortfolioAnalytics/demo/sortino.R pkg/PortfolioAnalytics/sandbox/script.UW2012.R pkg/PortfolioAnalytics/sandbox/script.buildEDHEC.R Log: - updaate Copyright to 2015 - change version numbering model to major.minor.svnrev Modified: pkg/PortfolioAnalytics/DESCRIPTION =================================================================== --- pkg/PortfolioAnalytics/DESCRIPTION 2015-01-07 13:04:56 UTC (rev 3580) +++ pkg/PortfolioAnalytics/DESCRIPTION 2015-01-07 13:12:49 UTC (rev 3581) @@ -2,7 +2,7 @@ Type: Package Title: Portfolio Analysis, including Numerical Methods for Optimization of Portfolios -Version: 0.9.0 +Version: 0.9.3581 Date: $Date$ Author: Brian G. Peterson, Peter Carl, Ross Bennett, Kris Boudt Contributors: R. Douglas Martin, Guy Yollin, Hezky Varon @@ -32,4 +32,4 @@ testthat, nloptr (>= 1.0.0) License: GPL -Copyright: (c) 2004-2014 +Copyright: (c) 2004-2015 Modified: pkg/PortfolioAnalytics/R/applyFUN.R =================================================================== --- pkg/PortfolioAnalytics/R/applyFUN.R 2015-01-07 13:04:56 UTC (rev 3580) +++ pkg/PortfolioAnalytics/R/applyFUN.R 2015-01-07 13:12:49 UTC (rev 3581) @@ -158,7 +158,7 @@ ############################################################################### # R (http://r-project.org/) Numeric Methods for Optimization of Portfolios # -# Copyright (c) 2004-2014 Brian G. Peterson, Peter Carl, Ross Bennett, Kris Boudt +# Copyright (c) 2004-2015 Brian G. Peterson, Peter Carl, Ross Bennett, Kris Boudt # # This library is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PortfolioAnalytics/R/chart.RiskReward.R =================================================================== --- pkg/PortfolioAnalytics/R/chart.RiskReward.R 2015-01-07 13:04:56 UTC (rev 3580) +++ pkg/PortfolioAnalytics/R/chart.RiskReward.R 2015-01-07 13:12:49 UTC (rev 3581) @@ -41,7 +41,7 @@ ############################################################################### # R (http://r-project.org/) Numeric Methods for Optimization of Portfolios # -# Copyright (c) 2004-2014 Brian G. Peterson, Peter Carl, Ross Bennett, Kris Boudt +# Copyright (c) 2004-2015 Brian G. Peterson, Peter Carl, Ross Bennett, Kris Boudt # # This library is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PortfolioAnalytics/R/chart.Weights.R =================================================================== --- pkg/PortfolioAnalytics/R/chart.Weights.R 2015-01-07 13:04:56 UTC (rev 3580) +++ pkg/PortfolioAnalytics/R/chart.Weights.R 2015-01-07 13:12:49 UTC (rev 3581) @@ -107,7 +107,7 @@ ############################################################################### # R (http://r-project.org/) Numeric Methods for Optimization of Portfolios # -# Copyright (c) 2004-2014 Brian G. Peterson, Peter Carl, Ross Bennett, Kris Boudt +# Copyright (c) 2004-2015 Brian G. Peterson, Peter Carl, Ross Bennett, Kris Boudt # # This library is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PortfolioAnalytics/R/charts.DE.R =================================================================== --- pkg/PortfolioAnalytics/R/charts.DE.R 2015-01-07 13:04:56 UTC (rev 3580) +++ pkg/PortfolioAnalytics/R/charts.DE.R 2015-01-07 13:12:49 UTC (rev 3581) @@ -1,7 +1,7 @@ ############################################################################### # R (http://r-project.org/) Numeric Methods for Optimization of Portfolios # -# Copyright (c) 2004-2014 Brian G. Peterson, Peter Carl, Ross Bennett, Kris Boudt +# Copyright (c) 2004-2015 Brian G. Peterson, Peter Carl, Ross Bennett, Kris Boudt # # This library is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PortfolioAnalytics/R/charts.GenSA.R =================================================================== --- pkg/PortfolioAnalytics/R/charts.GenSA.R 2015-01-07 13:04:56 UTC (rev 3580) +++ pkg/PortfolioAnalytics/R/charts.GenSA.R 2015-01-07 13:12:49 UTC (rev 3581) @@ -171,7 +171,7 @@ ############################################################################### # R (http://r-project.org/) Numeric Methods for Optimization of Portfolios # -# Copyright (c) 2004-2014 Brian G. Peterson, Peter Carl, Ross Bennett, Kris Boudt +# Copyright (c) 2004-2015 Brian G. Peterson, Peter Carl, Ross Bennett, Kris Boudt # # This library is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PortfolioAnalytics/R/charts.PSO.R =================================================================== --- pkg/PortfolioAnalytics/R/charts.PSO.R 2015-01-07 13:04:56 UTC (rev 3580) +++ pkg/PortfolioAnalytics/R/charts.PSO.R 2015-01-07 13:12:49 UTC (rev 3581) @@ -232,7 +232,7 @@ ############################################################################### # R (http://r-project.org/) Numeric Methods for Optimization of Portfolios # -# Copyright (c) 2004-2014 Brian G. Peterson, Peter Carl, Ross Bennett, Kris Boudt +# Copyright (c) 2004-2015 Brian G. Peterson, Peter Carl, Ross Bennett, Kris Boudt # # This library is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PortfolioAnalytics/R/charts.ROI.R =================================================================== --- pkg/PortfolioAnalytics/R/charts.ROI.R 2015-01-07 13:04:56 UTC (rev 3580) +++ pkg/PortfolioAnalytics/R/charts.ROI.R 2015-01-07 13:12:49 UTC (rev 3581) @@ -172,7 +172,7 @@ ############################################################################### # R (http://r-project.org/) Numeric Methods for Optimization of Portfolios # -# Copyright (c) 2004-2014 Brian G. Peterson, Peter Carl, Ross Bennett, Kris Boudt +# Copyright (c) 2004-2015 Brian G. Peterson, Peter Carl, Ross Bennett, Kris Boudt # # This library is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PortfolioAnalytics/R/charts.RP.R =================================================================== --- pkg/PortfolioAnalytics/R/charts.RP.R 2015-01-07 13:04:56 UTC (rev 3580) +++ pkg/PortfolioAnalytics/R/charts.RP.R 2015-01-07 13:12:49 UTC (rev 3581) @@ -1,7 +1,7 @@ ############################################################################### # R (http://r-project.org/) Numeric Methods for Optimization of Portfolios # -# Copyright (c) 2004-2014 Brian G. Peterson, Peter Carl, Ross Bennett, Kris Boudt +# Copyright (c) 2004-2015 Brian G. Peterson, Peter Carl, Ross Bennett, Kris Boudt # # This library is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PortfolioAnalytics/R/charts.efficient.frontier.R =================================================================== --- pkg/PortfolioAnalytics/R/charts.efficient.frontier.R 2015-01-07 13:04:56 UTC (rev 3580) +++ pkg/PortfolioAnalytics/R/charts.efficient.frontier.R 2015-01-07 13:12:49 UTC (rev 3581) @@ -629,7 +629,7 @@ ############################################################################### # R (http://r-project.org/) Numeric Methods for Optimization of Portfolios # -# Copyright (c) 2004-2014 Brian G. Peterson, Peter Carl, Ross Bennett, Kris Boudt +# Copyright (c) 2004-2015 Brian G. Peterson, Peter Carl, Ross Bennett, Kris Boudt # # This library is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PortfolioAnalytics/R/charts.groups.R =================================================================== --- pkg/PortfolioAnalytics/R/charts.groups.R 2015-01-07 13:04:56 UTC (rev 3580) +++ pkg/PortfolioAnalytics/R/charts.groups.R 2015-01-07 13:12:49 UTC (rev 3581) @@ -139,7 +139,7 @@ ############################################################################### # R (http://r-project.org/) Numeric Methods for Optimization of Portfolios # -# Copyright (c) 2004-2014 Brian G. Peterson, Peter Carl, Ross Bennett, Kris Boudt +# Copyright (c) 2004-2015 Brian G. Peterson, Peter Carl, Ross Bennett, Kris Boudt # # This library is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PortfolioAnalytics/R/charts.multiple.R =================================================================== --- pkg/PortfolioAnalytics/R/charts.multiple.R 2015-01-07 13:04:56 UTC (rev 3580) +++ pkg/PortfolioAnalytics/R/charts.multiple.R 2015-01-07 13:12:49 UTC (rev 3581) @@ -153,7 +153,7 @@ ############################################################################### # R (http://r-project.org/) Numeric Methods for Optimization of Portfolios # -# Copyright (c) 2004-2014 Brian G. Peterson, Peter Carl, Ross Bennett, Kris Boudt +# Copyright (c) 2004-2015 Brian G. Peterson, Peter Carl, Ross Bennett, Kris Boudt # # This library is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PortfolioAnalytics/R/charts.risk.R =================================================================== --- pkg/PortfolioAnalytics/R/charts.risk.R 2015-01-07 13:04:56 UTC (rev 3580) +++ pkg/PortfolioAnalytics/R/charts.risk.R 2015-01-07 13:12:49 UTC (rev 3581) @@ -461,7 +461,7 @@ ############################################################################### # R (http://r-project.org/) Numeric Methods for Optimization of Portfolios # -# Copyright (c) 2004-2014 Brian G. Peterson, Peter Carl, Ross Bennett, Kris Boudt +# Copyright (c) 2004-2015 Brian G. Peterson, Peter Carl, Ross Bennett, Kris Boudt # # This library is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PortfolioAnalytics/R/constrained_objective.R =================================================================== --- pkg/PortfolioAnalytics/R/constrained_objective.R 2015-01-07 13:04:56 UTC (rev 3580) +++ pkg/PortfolioAnalytics/R/constrained_objective.R 2015-01-07 13:12:49 UTC (rev 3581) @@ -1,7 +1,7 @@ ############################################################################### # R (http://r-project.org/) Numeric Methods for Optimization of Portfolios # -# Copyright (c) 2004-2014 Brian G. Peterson, Peter Carl, Ross Bennett, Kris Boudt +# Copyright (c) 2004-2015 Brian G. Peterson, Peter Carl, Ross Bennett, Kris Boudt # # This library is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PortfolioAnalytics/R/constraint_fn_map.R =================================================================== --- pkg/PortfolioAnalytics/R/constraint_fn_map.R 2015-01-07 13:04:56 UTC (rev 3580) +++ pkg/PortfolioAnalytics/R/constraint_fn_map.R 2015-01-07 13:12:49 UTC (rev 3581) @@ -1102,7 +1102,7 @@ ############################################################################### # R (http://r-project.org/) Numeric Methods for Optimization of Portfolios # -# Copyright (c) 2004-2014 Brian G. Peterson, Peter Carl, Ross Bennett, Kris Boudt +# Copyright (c) 2004-2015 Brian G. Peterson, Peter Carl, Ross Bennett, Kris Boudt # # This library is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PortfolioAnalytics/R/constraints.R =================================================================== --- pkg/PortfolioAnalytics/R/constraints.R 2015-01-07 13:04:56 UTC (rev 3580) +++ pkg/PortfolioAnalytics/R/constraints.R 2015-01-07 13:12:49 UTC (rev 3581) @@ -1,7 +1,7 @@ ############################################################################### # R (http://r-project.org/) Numeric Methods for Optimization of Portfolios # -# Copyright (c) 2004-2014 Brian G. Peterson, Peter Carl, Ross Bennett, Kris Boudt +# Copyright (c) 2004-2015 Brian G. Peterson, Peter Carl, Ross Bennett, Kris Boudt # # This library is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PortfolioAnalytics/R/constraintsFUN.R =================================================================== --- pkg/PortfolioAnalytics/R/constraintsFUN.R 2015-01-07 13:04:56 UTC (rev 3580) +++ pkg/PortfolioAnalytics/R/constraintsFUN.R 2015-01-07 13:12:49 UTC (rev 3581) @@ -16,7 +16,7 @@ ############################################################################### # R (http://r-project.org/) Numeric Methods for Optimization of Portfolios # -# Copyright (c) 2004-2014 Brian G. Peterson, Peter Carl, Ross Bennett, Kris Boudt +# Copyright (c) 2004-2015 Brian G. Peterson, Peter Carl, Ross Bennett, Kris Boudt # # This library is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PortfolioAnalytics/R/constraints_ROI.R =================================================================== --- pkg/PortfolioAnalytics/R/constraints_ROI.R 2015-01-07 13:04:56 UTC (rev 3580) +++ pkg/PortfolioAnalytics/R/constraints_ROI.R 2015-01-07 13:12:49 UTC (rev 3581) @@ -64,7 +64,7 @@ ############################################################################### # R (http://r-project.org/) Numeric Methods for Optimization of Portfolios # -# Copyright (c) 2004-2014 Brian G. Peterson, Peter Carl, Ross Bennett, Kris Boudt +# Copyright (c) 2004-2015 Brian G. Peterson, Peter Carl, Ross Bennett, Kris Boudt # # This library is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PortfolioAnalytics/R/equal.weight.R =================================================================== --- pkg/PortfolioAnalytics/R/equal.weight.R 2015-01-07 13:04:56 UTC (rev 3580) +++ pkg/PortfolioAnalytics/R/equal.weight.R 2015-01-07 13:12:49 UTC (rev 3581) @@ -52,7 +52,7 @@ ############################################################################### # R (http://r-project.org/) Numeric Methods for Optimization of Portfolios # -# Copyright (c) 2004-2014 Brian G. Peterson, Peter Carl, Ross Bennett, Kris Boudt +# Copyright (c) 2004-2015 Brian G. Peterson, Peter Carl, Ross Bennett, Kris Boudt # # This library is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PortfolioAnalytics/R/extract.efficient.frontier.R =================================================================== --- pkg/PortfolioAnalytics/R/extract.efficient.frontier.R 2015-01-07 13:04:56 UTC (rev 3580) +++ pkg/PortfolioAnalytics/R/extract.efficient.frontier.R 2015-01-07 13:12:49 UTC (rev 3581) @@ -1,7 +1,7 @@ ############################################################################### # R (http://r-project.org/) Numeric Methods for Optimization of Portfolios # -# Copyright (c) 2004-2014 Brian G. Peterson, Peter Carl, Ross Bennett, Kris Boudt +# Copyright (c) 2004-2015 Brian G. Peterson, Peter Carl, Ross Bennett, Kris Boudt # # This library is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PortfolioAnalytics/R/extractstats.R =================================================================== --- pkg/PortfolioAnalytics/R/extractstats.R 2015-01-07 13:04:56 UTC (rev 3580) +++ pkg/PortfolioAnalytics/R/extractstats.R 2015-01-07 13:12:49 UTC (rev 3581) @@ -1,7 +1,7 @@ ############################################################################### # R (http://r-project.org/) Numeric Methods for Optimization of Portfolios # -# Copyright (c) 2004-2014 Brian G. Peterson, Peter Carl, Ross Bennett, Kris Boudt +# Copyright (c) 2004-2015 Brian G. Peterson, Peter Carl, Ross Bennett, Kris Boudt # # This library is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PortfolioAnalytics/R/generics.R =================================================================== --- pkg/PortfolioAnalytics/R/generics.R 2015-01-07 13:04:56 UTC (rev 3580) +++ pkg/PortfolioAnalytics/R/generics.R 2015-01-07 13:12:49 UTC (rev 3581) @@ -1,7 +1,7 @@ ############################################################################### # R (http://r-project.org/) Numeric Methods for Optimization of Portfolios # -# Copyright (c) 2004-2014 Brian G. Peterson, Peter Carl, Ross Bennett, Kris Boudt +# Copyright (c) 2004-2015 Brian G. Peterson, Peter Carl, Ross Bennett, Kris Boudt # # This library is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PortfolioAnalytics/R/inverse.volatility.weight.R =================================================================== --- pkg/PortfolioAnalytics/R/inverse.volatility.weight.R 2015-01-07 13:04:56 UTC (rev 3580) +++ pkg/PortfolioAnalytics/R/inverse.volatility.weight.R 2015-01-07 13:12:49 UTC (rev 3581) @@ -53,7 +53,7 @@ ############################################################################### # R (http://r-project.org/) Numeric Methods for Optimization of Portfolios # -# Copyright (c) 2004-2014 Brian G. Peterson, Peter Carl, Ross Bennett, Kris Boudt +# Copyright (c) 2004-2015 Brian G. Peterson, Peter Carl, Ross Bennett, Kris Boudt # # This library is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PortfolioAnalytics/R/moment.functions.R =================================================================== --- pkg/PortfolioAnalytics/R/moment.functions.R 2015-01-07 13:04:56 UTC (rev 3580) +++ pkg/PortfolioAnalytics/R/moment.functions.R 2015-01-07 13:12:49 UTC (rev 3581) @@ -1,7 +1,7 @@ ############################################################################### # R (http://r-project.org/) Numeric Methods for Optimization of Portfolios # -# Copyright (c) 2004-2014 Brian G. Peterson, Peter Carl, Ross Bennett, Kris Boudt +# Copyright (c) 2004-2015 Brian G. Peterson, Peter Carl, Ross Bennett, Kris Boudt # # This library is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PortfolioAnalytics/R/objective.R =================================================================== --- pkg/PortfolioAnalytics/R/objective.R 2015-01-07 13:04:56 UTC (rev 3580) +++ pkg/PortfolioAnalytics/R/objective.R 2015-01-07 13:12:49 UTC (rev 3581) @@ -1,7 +1,7 @@ ############################################################################### # R (http://r-project.org/) Numeric Methods for Optimization of Portfolios # -# Copyright (c) 2004-2014 Brian G. Peterson, Peter Carl, Ross Bennett, Kris Boudt +# Copyright (c) 2004-2015 Brian G. Peterson, Peter Carl, Ross Bennett, Kris Boudt # # This library is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PortfolioAnalytics/R/objectiveFUN.R =================================================================== --- pkg/PortfolioAnalytics/R/objectiveFUN.R 2015-01-07 13:04:56 UTC (rev 3580) +++ pkg/PortfolioAnalytics/R/objectiveFUN.R 2015-01-07 13:12:49 UTC (rev 3581) @@ -73,7 +73,7 @@ ############################################################################### # R (http://r-project.org/) Numeric Methods for Optimization of Portfolios # -# Copyright (c) 2004-2014 Brian G. Peterson, Peter Carl, Ross Bennett, Kris Boudt +# Copyright (c) 2004-2015 Brian G. Peterson, Peter Carl, Ross Bennett, Kris Boudt # # This library is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PortfolioAnalytics/R/optFUN.R =================================================================== --- pkg/PortfolioAnalytics/R/optFUN.R 2015-01-07 13:04:56 UTC (rev 3580) +++ pkg/PortfolioAnalytics/R/optFUN.R 2015-01-07 13:12:49 UTC (rev 3581) @@ -1452,7 +1452,7 @@ ############################################################################### # R (http://r-project.org/) Numeric Methods for Optimization of Portfolios # -# Copyright (c) 2004-2014 Brian G. Peterson, Peter Carl, Ross Bennett, Kris Boudt +# Copyright (c) 2004-2015 Brian G. Peterson, Peter Carl, Ross Bennett, Kris Boudt # # This library is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PortfolioAnalytics/R/optimize.portfolio.R =================================================================== --- pkg/PortfolioAnalytics/R/optimize.portfolio.R 2015-01-07 13:04:56 UTC (rev 3580) +++ pkg/PortfolioAnalytics/R/optimize.portfolio.R 2015-01-07 13:12:49 UTC (rev 3581) @@ -1,7 +1,7 @@ ############################################################################### # R (http://r-project.org/) Numeric Methods for Optimization of Portfolios # -# Copyright (c) 2004-2014 Brian G. Peterson, Peter Carl, Ross Bennett, Kris Boudt +# Copyright (c) 2004-2015 Brian G. Peterson, Peter Carl, Ross Bennett, Kris Boudt # # This library is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PortfolioAnalytics/R/portfolio.R =================================================================== --- pkg/PortfolioAnalytics/R/portfolio.R 2015-01-07 13:04:56 UTC (rev 3580) +++ pkg/PortfolioAnalytics/R/portfolio.R 2015-01-07 13:12:49 UTC (rev 3581) @@ -1,7 +1,7 @@ ############################################################################### # R (http://r-project.org/) Numeric Methods for Optimization of Portfolios # -# Copyright (c) 2004-2014 Brian G. Peterson, Peter Carl, Ross Bennett, Kris Boudt +# Copyright (c) 2004-2015 Brian G. Peterson, Peter Carl, Ross Bennett, Kris Boudt # # This library is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PortfolioAnalytics/R/random_portfolios.R =================================================================== --- pkg/PortfolioAnalytics/R/random_portfolios.R 2015-01-07 13:04:56 UTC (rev 3580) +++ pkg/PortfolioAnalytics/R/random_portfolios.R 2015-01-07 13:12:49 UTC (rev 3581) @@ -1,7 +1,7 @@ ############################################################################### # R (http://r-project.org/) Numeric Methods for Optimization of Portfolios # -# Copyright (c) 2004-2014 Brian G. Peterson, Peter Carl, Ross Bennett, Kris Boudt +# Copyright (c) 2004-2015 Brian G. Peterson, Peter Carl, Ross Bennett, Kris Boudt # # This library is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PortfolioAnalytics/R/stat.factor.model.R =================================================================== --- pkg/PortfolioAnalytics/R/stat.factor.model.R 2015-01-07 13:04:56 UTC (rev 3580) +++ pkg/PortfolioAnalytics/R/stat.factor.model.R 2015-01-07 13:12:49 UTC (rev 3581) @@ -1,7 +1,7 @@ ############################################################################### # R (http://r-project.org/) Numeric Methods for Optimization of Portfolios # -# Copyright (c) 2004-2014 Brian G. Peterson, Peter Carl, Ross Bennett, Kris Boudt +# Copyright (c) 2004-2015 Brian G. Peterson, Peter Carl, Ross Bennett, Kris Boudt # # This library is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PortfolioAnalytics/R/trailingFUN.R =================================================================== --- pkg/PortfolioAnalytics/R/trailingFUN.R 2015-01-07 13:04:56 UTC (rev 3580) +++ pkg/PortfolioAnalytics/R/trailingFUN.R 2015-01-07 13:12:49 UTC (rev 3581) @@ -1,7 +1,7 @@ ############################################################################### # R (http://r-project.org/) Numeric Methods for Optimization of Portfolios # -# Copyright (c) 2004-2014 Brian G. Peterson, Peter Carl, Ross Bennett, Kris Boudt +# Copyright (c) 2004-2015 Brian G. Peterson, Peter Carl, Ross Bennett, Kris Boudt # # This library is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PortfolioAnalytics/R/utility.combine.R =================================================================== --- pkg/PortfolioAnalytics/R/utility.combine.R 2015-01-07 13:04:56 UTC (rev 3580) +++ pkg/PortfolioAnalytics/R/utility.combine.R 2015-01-07 13:12:49 UTC (rev 3581) @@ -40,7 +40,7 @@ ############################################################################### # R (http://r-project.org/) Numeric Methods for Optimization of Portfolios # -# Copyright (c) 2004-2014 Brian G. Peterson, Peter Carl, Ross Bennett, Kris Boudt +# Copyright (c) 2004-2015 Brian G. Peterson, Peter Carl, Ross Bennett, Kris Boudt # # This library is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PortfolioAnalytics/R/utils.R =================================================================== --- pkg/PortfolioAnalytics/R/utils.R 2015-01-07 13:04:56 UTC (rev 3580) +++ pkg/PortfolioAnalytics/R/utils.R 2015-01-07 13:12:49 UTC (rev 3581) @@ -55,7 +55,7 @@ ############################################################################### # R (http://r-project.org/) Numeric Methods for Optimization of Portfolios # -# Copyright (c) 2004-2014 Brian G. Peterson, Peter Carl, Ross Bennett, Kris Boudt +# Copyright (c) 2004-2015 Brian G. Peterson, Peter Carl, Ross Bennett, Kris Boudt # # This library is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PortfolioAnalytics/codeblock.txt =================================================================== --- pkg/PortfolioAnalytics/codeblock.txt 2015-01-07 13:04:56 UTC (rev 3580) +++ pkg/PortfolioAnalytics/codeblock.txt 2015-01-07 13:12:49 UTC (rev 3581) @@ -2,7 +2,7 @@ ############################################################################### # R (http://r-project.org/) Numeric Methods for Optimization of Portfolios # -# Copyright (c) 2004-2014 Brian G. Peterson, Peter Carl, Ross Bennett, Kris Boudt +# Copyright (c) 2004-2015 Brian G. Peterson, Peter Carl, Ross Bennett, Kris Boudt # # This library is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Modified: pkg/PortfolioAnalytics/demo/sortino.R =================================================================== --- pkg/PortfolioAnalytics/demo/sortino.R 2015-01-07 13:04:56 UTC (rev 3580) +++ pkg/PortfolioAnalytics/demo/sortino.R 2015-01-07 13:12:49 UTC (rev 3581) @@ -49,7 +49,7 @@ ############################################################################### # R (http://r-project.org/) Numeric Methods for Optimization of Portfolios # -# Copyright (c) 2004-2010 Kris Boudt, Peter Carl and Brian G. Peterson +# Copyright (c) 2004-2014 Kris Boudt, Peter Carl and Brian G. Peterson # # This library is distributed under the terms of the GNU Public License (GPL) # for full details see the file COPYING Deleted: pkg/PortfolioAnalytics/man/constraint_ROI.Rd =================================================================== --- pkg/PortfolioAnalytics/man/constraint_ROI.Rd 2015-01-07 13:04:56 UTC (rev 3580) +++ pkg/PortfolioAnalytics/man/constraint_ROI.Rd 2015-01-07 13:12:49 UTC (rev 3581) @@ -1,24 +0,0 @@ -% Generated by roxygen2 (4.0.1): do not edit by hand -\name{constraint_ROI} -\alias{constraint_ROI} -\title{constructor for class constraint_ROI} -\usage{ -constraint_ROI(assets = NULL, op.problem, solver = c("glpk", "quadprog"), - weight_seq = NULL) -} -\arguments{ -\item{assets}{number of assets, or optionally a named vector of assets specifying seed weights} - -\item{op.problem}{an object of type "OP" (optimization problem, of \code{ROI}) specifying the complete optimization problem, see ROI help pages for proper construction of OP object.} - -\item{solver}{string argument for what solver package to use, must have ROI plugin installed for that solver. Currently support is for \code{glpk} and \code{quadprog}.} - -\item{weight_seq}{seed sequence of weights, see \code{\link{generatesequence}}} -} -\description{ -constructor for class constraint_ROI -} -\author{ -Hezky Varon -} - Modified: pkg/PortfolioAnalytics/sandbox/script.UW2012.R =================================================================== --- pkg/PortfolioAnalytics/sandbox/script.UW2012.R 2015-01-07 13:04:56 UTC (rev 3580) +++ pkg/PortfolioAnalytics/sandbox/script.UW2012.R 2015-01-07 13:12:49 UTC (rev 3581) @@ -557,12 +557,9 @@ for(result in names(results)[grep('.t',names(results),fixed=TRUE)]){ print(result) x=get('results')[[result]] - x.obj=rbind(x.obj, data.frame(mean=x$"2012-02-29"$objective_measures[[1]],pasd=x$"2012-02-29"$objective_measures[[2]],CVaR=as.numeric(x$"2012-02-29"$objective_measures[[3]][1]))) - - print(x.obj) - - #RND.objectives = rbind(RND.objectives,x.obj) + x.obj=rbind(x.obj, data.frame(mean=x[[evalDate]]$objective_measures[[1]],pasd=x[[evalDate]]$objective_measures[[2]],CVaR=as.numeric(x[[evalDate]]$objective_measures[[3]][1]))) } +print(x.obj) rownames(x.obj)=names(results)[grep('.t',names(results),fixed=TRUE)] # @TODO: add prettier labels Modified: pkg/PortfolioAnalytics/sandbox/script.buildEDHEC.R =================================================================== --- pkg/PortfolioAnalytics/sandbox/script.buildEDHEC.R 2015-01-07 13:04:56 UTC (rev 3580) +++ pkg/PortfolioAnalytics/sandbox/script.buildEDHEC.R 2015-01-07 13:12:49 UTC (rev 3581) @@ -10,7 +10,8 @@ # Download the following file to the working directory: # http://www.edhec-risk.com/indexes/pure_style/data/table/history.csv ### @TODO: Is there a way to download it directly? Maybe not, seems to require a login -x=read.csv(file="history.csv", sep=";", header=TRUE, check.names=FALSE) +x<-read.csv(file=download.file("http://www.edhec-risk.com/indexes/pure_style/data/table/history.csv"), sep=";", header=TRUE, check.names=FALSE) +#x=read.csv(file="history.csv", sep=";", header=TRUE, check.names=FALSE) x.dates = as.Date(x[,1], format="%d/%m/%Y") x.data = apply(x[,-1], MARGIN=2, FUN=function(x){as.numeric(sub("%","", x, fixed=TRUE))/100}) # get rid of percentage signs edhec = xts(x.data, order.by=x.dates) From noreply at r-forge.r-project.org Sun Jan 25 22:38:10 2015 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sun, 25 Jan 2015 22:38:10 +0100 (CET) Subject: [Returnanalytics-commits] r3582 - in pkg/PortfolioAnalytics: R man Message-ID: <20150125213810.3412E183D37@r-forge.r-project.org> Author: rossbennett34 Date: 2015-01-25 22:38:09 +0100 (Sun, 25 Jan 2015) New Revision: 3582 Modified: pkg/PortfolioAnalytics/R/EntropyProg.R pkg/PortfolioAnalytics/R/chart.concentration.R pkg/PortfolioAnalytics/R/extract.efficient.frontier.R pkg/PortfolioAnalytics/R/extractstats.R pkg/PortfolioAnalytics/R/moment.functions.R pkg/PortfolioAnalytics/R/optFUN.R pkg/PortfolioAnalytics/R/optimize.portfolio.R pkg/PortfolioAnalytics/R/random_portfolios.R pkg/PortfolioAnalytics/man/optimize.portfolio.rebalancing.Rd Log: cleaning up global variables in code and documentation for R CMD check Modified: pkg/PortfolioAnalytics/R/EntropyProg.R =================================================================== --- pkg/PortfolioAnalytics/R/EntropyProg.R 2015-01-07 13:12:49 UTC (rev 3581) +++ pkg/PortfolioAnalytics/R/EntropyProg.R 2015-01-25 21:38:09 UTC (rev 3582) @@ -260,8 +260,8 @@ D = x[2] - x[1] N = length(x) - np = zeros(N , 1) - + # np = zeros(N , 1) + np = matrix(0, nrow=N, ncol=1) for (s in 1:N) { # The boolean Index is true is X is within the interval centered at x(s) and within a half-break distance Modified: pkg/PortfolioAnalytics/R/chart.concentration.R =================================================================== --- pkg/PortfolioAnalytics/R/chart.concentration.R 2015-01-07 13:12:49 UTC (rev 3581) +++ pkg/PortfolioAnalytics/R/chart.concentration.R 2015-01-25 21:38:09 UTC (rev 3582) @@ -51,6 +51,7 @@ conc.type <- match.arg(conc.type) columnnames <- colnames(xtract) + R <- object$R # Get the return and risk columns from xtract return.column <- pmatch(return.col, columnnames) @@ -136,7 +137,7 @@ y <- (x.hhi - min(x.hhi)) / (max(x.hhi) - min(x.hhi)) op <- par(no.readonly=TRUE) - layout(matrix(c(1,2)),height=c(4,1.25),width=1) + layout(matrix(c(1,2)),heights=c(4,1.25),widths=1) par(mar=c(5,4,1,2)+.1, cex=1) # c(bottom, left, top, right) # plot the asset in risk-return space ordered based on degree of concentration Modified: pkg/PortfolioAnalytics/R/extract.efficient.frontier.R =================================================================== --- pkg/PortfolioAnalytics/R/extract.efficient.frontier.R 2015-01-07 13:12:49 UTC (rev 3581) +++ pkg/PortfolioAnalytics/R/extract.efficient.frontier.R 2015-01-25 21:38:09 UTC (rev 3582) @@ -60,6 +60,7 @@ } set<-cbind(quantmod::Lag(set,1),as.matrix(set))[-1,] + i <- 1 result <- foreach(i=1:nrow(set),.inorder=TRUE, .combine=rbind, .errorhandling='remove') %do% { tmp<-xtract[which(xtract[,mtc]>=set[i,1] & xtract[,mtc] 1){ - warning(paste("Multiple methods detected for cleaning returns, default to use clean =", tmp[1])) + warning(paste("Multiple methods detected for cleaning returns, default to use clean =", clean[1])) } cleanR <- Return.clean(R, method=clean[1]) cleaned <- TRUE @@ -394,7 +394,7 @@ clean <- unlist(lapply(portfolio$objectives, function(x) x$arguments$clean)) if(!is.null(clean)){ if(length(unique(clean)) > 1){ - warning(paste("Multiple methods detected for cleaning returns, default to use clean =", tmp[1])) + warning(paste("Multiple methods detected for cleaning returns, default to use clean =", clean[1])) } # This sets R as the cleaned returns for the rest of the function # This is proably fine since the only other place R is used is for the @@ -478,7 +478,7 @@ clean <- unlist(lapply(portfolio$objectives, function(x) x$arguments$clean)) if(!is.null(clean)){ if(length(unique(clean)) > 1){ - warning(paste("Multiple methods detected for cleaning returns, default to use clean =", tmp[1])) + warning(paste("Multiple methods detected for cleaning returns, default to use clean =", clean[1])) } # This sets R as the cleaned returns for the rest of the function # This is proably fine since the only other place R is used is for the Modified: pkg/PortfolioAnalytics/R/optFUN.R =================================================================== --- pkg/PortfolioAnalytics/R/optFUN.R 2015-01-07 13:12:49 UTC (rev 3581) +++ pkg/PortfolioAnalytics/R/optFUN.R 2015-01-25 21:38:09 UTC (rev 3582) @@ -356,7 +356,7 @@ # Add the factor exposures to Amat, dir, and rhs if(!is.null(constraints$B)){ - t.B <- t(B) + t.B <- t(constraints$B) zeros <- matrix(data=0, nrow=nrow(t.B), ncol=ncol(t.B)) Amat <- rbind(Amat, cbind(t.B, zeros), cbind(-t.B, zeros)) dir <- c(dir, rep(">=", 2 * nrow(t.B))) Modified: pkg/PortfolioAnalytics/R/optimize.portfolio.R =================================================================== --- pkg/PortfolioAnalytics/R/optimize.portfolio.R 2015-01-07 13:12:49 UTC (rev 3581) +++ pkg/PortfolioAnalytics/R/optimize.portfolio.R 2015-01-25 21:38:09 UTC (rev 3582) @@ -115,14 +115,41 @@ DEcformals$NP <- NP DEcformals$itermax <- itermax DEcformals[pm] <- dotargs[pm > 0L] - if(!hasArg(strategy)) DEcformals$strategy=6 # use DE/current-to-p-best/1 - if(!hasArg(reltol)) DEcformals$reltol=.000001 # 1/1000 of 1% change in objective is significant - if(!hasArg(steptol)) DEcformals$steptol=round(N*1.5) # number of assets times 1.5 tries to improve - if(!hasArg(c)) DEcformals$c=.4 # JADE mutation parameter, this could maybe use some adjustment - if(!hasArg(storepopfrom)) DEcformals$storepopfrom=1 + if(!hasArg(strategy)) { + # use DE/current-to-p-best/1 + strategy=6 + DEcformals$strategy=strategy + } + if(!hasArg(reltol)) { + # 1/1000 of 1% change in objective is significant + reltol=.000001 + DEcformals$reltol=reltol + } + if(!hasArg(steptol)) { + # number of assets times 1.5 tries to improve + steptol=round(N*1.5) + DEcformals$steptol=steptol + } + if(!hasArg(c)) { + # JADE mutation parameter, this could maybe use some adjustment + tmp.c=.4 + DEcformals$c=tmp.c + } + if(!hasArg(storepopfrom)) { + storepopfrom=1 + DEcformals$storepopfrom=storepopfrom + } if(isTRUE(parallel) && 'package:foreach' %in% search()){ - if(!hasArg(parallelType) ) DEcformals$parallelType='auto' #use all cores - if(!hasArg(packages) ) DEcformals$packages <- names(sessionInfo()$otherPkgs) #use all packages + if(!hasArg(parallelType)) { + #use all cores + parallelType='auto' + DEcformals$parallelType=parallelType + } + if(!hasArg(packages)) { + #use all packages + packages <- names(sessionInfo()$otherPkgs) + DEcformals$packages <- packages + } } #TODO FIXME also check for a passed in controlDE list, including checking its class, and match formals @@ -190,6 +217,7 @@ if (isTRUE(trace)) out$random_portfolios<-rp #' write foreach loop to call constrained_objective() with each portfolio if ("package:foreach" %in% search() & !hasArg(parallel)){ + ii <- 1 rp_objective_results<-foreach(ii=1:nrow(rp), .errorhandling='pass') %dopar% constrained_objective_v1(w=rp[ii,],R,constraints,trace=trace,...=dotargs) } else { rp_objective_results<-apply(rp, 1, constrained_objective_v1, R=R, constraints=constraints, trace=trace, ...=dotargs) @@ -337,8 +365,15 @@ #NOTE reltol has a different meaning for pso than it has for DEoptim. for DEoptim, reltol is a stopping criteria, for pso, # it is a restart criteria. - if(!hasArg(s)) controlPSO$s<-N*10 #swarm size - if(!hasArg(maxit.stagnate)) controlPSO$maxit.stagnate <- controlPSO$s #stopping criteria + if(!hasArg(s)) { + s <- N*10 + controlPSO$s<-s + } #swarm size + if(!hasArg(maxit.stagnate)) { + #stopping criteria + maxit.stagnate <- controlPSO$s + controlPSO$maxit.stagnate <- maxit.stagnate + } if(hasArg(trace) && try(trace==TRUE,silent=TRUE)) controlPSO$trace <- TRUE if(hasArg(trace) && isTRUE(trace)) { controlPSO$trace <- TRUE @@ -652,14 +687,41 @@ DEcformals$NP <- NP DEcformals$itermax <- itermax DEcformals[pm] <- dotargs[pm > 0L] - if(!hasArg(strategy)) DEcformals$strategy=6 # use DE/current-to-p-best/1 - if(!hasArg(reltol)) DEcformals$reltol=.000001 # 1/1000 of 1% change in objective is significant - if(!hasArg(steptol)) DEcformals$steptol=round(N*1.5) # number of assets times 1.5 tries to improve - if(!hasArg(c)) DEcformals$c=.4 # JADE mutation parameter, this could maybe use some adjustment - if(!hasArg(storepopfrom)) DEcformals$storepopfrom=1 + if(!hasArg(strategy)) { + # use DE/current-to-p-best/1 + strategy=6 + DEcformals$strategy=strategy + } + if(!hasArg(reltol)) { + # 1/1000 of 1% change in objective is significant + reltol=0.000001 + DEcformals$reltol=reltol + } + if(!hasArg(steptol)) { + # number of assets times 1.5 tries to improve + steptol=round(N*1.5) + DEcformals$steptol=steptol + } + if(!hasArg(c)) { + # JADE mutation parameter, this could maybe use some adjustment + tmp.c=0.4 + DEcformals$c=tmp.c + } + if(!hasArg(storepopfrom)) { + storepopfrom=1 + DEcformals$storepopfrom=storepopfrom + } if(isTRUE(parallel) && 'package:foreach' %in% search()){ - if(!hasArg(parallelType) ) DEcformals$parallelType='auto' #use all cores - if(!hasArg(packages) ) DEcformals$packages <- names(sessionInfo()$otherPkgs) #use all packages + if(!hasArg(parallelType)) { + #use all cores + parallelType='auto' + DEcformals$parallelType=parallelType + } + if(!hasArg(packages)) { + #use all packages + packages <- names(sessionInfo()$otherPkgs) + DEcformals$packages <- packages + } } #TODO FIXME also check for a passed in controlDE list, including checking its class, and match formals } @@ -765,6 +827,7 @@ # rp is already being generated with a call to fn_map so set normalize=FALSE in the call to constrained_objective #' write foreach loop to call constrained_objective() with each portfolio if ("package:foreach" %in% search() & !hasArg(parallel)){ + ii <- 1 rp_objective_results <- foreach(ii=1:nrow(rp), .errorhandling='pass') %dopar% constrained_objective(w=rp[ii,], R=R, portfolio=portfolio, trace=trace, env=dotargs, normalize=FALSE) } else { rp_objective_results <- apply(rp, 1, constrained_objective, R=R, portfolio=portfolio, trace=trace, normalize=FALSE, env=dotargs) @@ -1276,7 +1339,7 @@ #' @rdname optimize.portfolio.rebalancing #' @name optimize.portfolio.rebalancing #' @export -optimize.portfolio.rebalancing_v1 <- function(R,constraints,optimize_method=c("DEoptim","random","ROI"), search_size=20000, trace=FALSE, ..., rp=NULL, rebalance_on=NULL, training_period=NULL, trailing_periods=NULL) +optimize.portfolio.rebalancing_v1 <- function(R,constraints,optimize_method=c("DEoptim","random","ROI"), search_size=20000, trace=FALSE, ..., rp=NULL, rebalance_on=NULL, training_period=NULL, rolling_window=NULL) { stopifnot("package:foreach" %in% search() || require("foreach",quietly=TRUE)) start_t<-Sys.time() @@ -1289,13 +1352,21 @@ rp<-random_portfolios(rpconstraints=constraints,permutations=search_size) } else { rp=NULL - } + } + # check for trailing_periods argument and set rolling_window equal to + # trailing_periods for backwards compatibility + if(hasArg(trailing_periods)) { + trailing_periods=match.call(expand.dots=TRUE)$trailing_periods + rolling_window <- trailing_periods + } + if(is.null(training_period)) {if(nrow(R)<36) training_period=nrow(R) else training_period=36} - if (is.null(trailing_periods)){ + if (is.null(rolling_window)){ # define the index endpoints of our periods ep.i<-endpoints(R,on=rebalance_on)[which(endpoints(R, on = rebalance_on)>=training_period)] # now apply optimize.portfolio to the periods, in parallel if available + ep <- ep.i[1] out_list<-foreach(ep=iter(ep.i), .errorhandling='pass', .packages='PortfolioAnalytics') %dopar% { optimize.portfolio(R[1:ep,],constraints=constraints,optimize_method=optimize_method, search_size=search_size, trace=trace, rp=rp, parallel=FALSE, ...=...) } @@ -1304,7 +1375,7 @@ ep.i<-endpoints(R,on=rebalance_on)[which(endpoints(R, on = rebalance_on)>=training_period)] # now apply optimize.portfolio to the periods, in parallel if available out_list<-foreach(ep=iter(ep.i), .errorhandling='pass', .packages='PortfolioAnalytics') %dopar% { - optimize.portfolio(R[(ifelse(ep-trailing_periods>=1,ep-trailing_periods,1)):ep,],constraints=constraints,optimize_method=optimize_method, search_size=search_size, trace=trace, rp=rp, parallel=FALSE, ...=...) + optimize.portfolio(R[(ifelse(ep-rolling_window>=1,ep-rolling_window,1)):ep,],constraints=constraints,optimize_method=optimize_method, search_size=search_size, trace=trace, rp=rp, parallel=FALSE, ...=...) } } names(out_list)<-index(R[ep.i]) @@ -1505,6 +1576,7 @@ # define the index endpoints of our periods ep.i<-endpoints(R,on=rebalance_on)[which(endpoints(R, on = rebalance_on)>=training_period)] # now apply optimize.portfolio to the periods, in parallel if available + ep <- ep.i[1] out_list<-foreach(ep=iter(ep.i), .errorhandling='pass', .packages='PortfolioAnalytics') %dopar% { optimize.portfolio(R[1:ep,], portfolio=portfolio, optimize_method=optimize_method, search_size=search_size, trace=trace, rp=rp, parallel=FALSE, ...=...) } Modified: pkg/PortfolioAnalytics/R/random_portfolios.R =================================================================== --- pkg/PortfolioAnalytics/R/random_portfolios.R 2015-01-07 13:12:49 UTC (rev 3581) +++ pkg/PortfolioAnalytics/R/random_portfolios.R 2015-01-25 21:38:09 UTC (rev 3582) @@ -540,6 +540,8 @@ # do the transformation to the set of weights to satisfy lower bounds stopifnot("package:foreach" %in% search() || require("foreach",quietly = TRUE)) + j <- 1 + i <- 1 out <- foreach(j = 1:length(fev), .combine=c) %:% foreach(i=1:nrow(Umat)) %dopar% { q <- 2^fev[j] tmp <- L + (1 - sum(L)) * log(Umat[i,])^q / sum(log(Umat[i,])^q) Modified: pkg/PortfolioAnalytics/man/optimize.portfolio.rebalancing.Rd =================================================================== --- pkg/PortfolioAnalytics/man/optimize.portfolio.rebalancing.Rd 2015-01-07 13:12:49 UTC (rev 3581) +++ pkg/PortfolioAnalytics/man/optimize.portfolio.rebalancing.Rd 2015-01-25 21:38:09 UTC (rev 3582) @@ -7,7 +7,7 @@ optimize.portfolio.rebalancing_v1(R, constraints, optimize_method = c("DEoptim", "random", "ROI"), search_size = 20000, trace = FALSE, ..., rp = NULL, rebalance_on = NULL, - training_period = NULL, trailing_periods = NULL) + training_period = NULL, rolling_window = NULL) optimize.portfolio.rebalancing(R, portfolio = NULL, constraints = NULL, objectives = NULL, optimize_method = c("DEoptim", "random", "ROI"), From noreply at r-forge.r-project.org Tue Jan 27 04:29:59 2015 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Tue, 27 Jan 2015 04:29:59 +0100 (CET) Subject: [Returnanalytics-commits] r3583 - in pkg/PortfolioAnalytics: . R man vignettes Message-ID: <20150127032959.ED9ED186F81@r-forge.r-project.org> Author: rossbennett34 Date: 2015-01-27 04:29:58 +0100 (Tue, 27 Jan 2015) New Revision: 3583 Added: pkg/PortfolioAnalytics/man/constraint_ROI.Rd pkg/PortfolioAnalytics/man/gmv_opt_leverage.Rd pkg/PortfolioAnalytics/man/pHist.Rd Modified: pkg/PortfolioAnalytics/NAMESPACE pkg/PortfolioAnalytics/R/applyFUN.R pkg/PortfolioAnalytics/R/charts.DE.R pkg/PortfolioAnalytics/R/charts.PSO.R pkg/PortfolioAnalytics/R/charts.RP.R pkg/PortfolioAnalytics/R/charts.efficient.frontier.R pkg/PortfolioAnalytics/R/extractstats.R pkg/PortfolioAnalytics/R/moment.functions.R pkg/PortfolioAnalytics/R/mult.layer.portfolio.R pkg/PortfolioAnalytics/R/stat.factor.model.R pkg/PortfolioAnalytics/man/BlackLittermanFormula.Rd pkg/PortfolioAnalytics/man/CCCgarch.MM.Rd pkg/PortfolioAnalytics/man/EntropyProg.Rd pkg/PortfolioAnalytics/man/HHI.Rd pkg/PortfolioAnalytics/man/ac.ranking.Rd pkg/PortfolioAnalytics/man/add.constraint.Rd pkg/PortfolioAnalytics/man/add.objective.Rd pkg/PortfolioAnalytics/man/add.sub.portfolio.Rd pkg/PortfolioAnalytics/man/applyFUN.Rd pkg/PortfolioAnalytics/man/barplotGroupWeights.Rd pkg/PortfolioAnalytics/man/black.litterman.Rd pkg/PortfolioAnalytics/man/box_constraint.Rd pkg/PortfolioAnalytics/man/center.Rd pkg/PortfolioAnalytics/man/centroid.buckets.Rd pkg/PortfolioAnalytics/man/centroid.complete.mc.Rd pkg/PortfolioAnalytics/man/centroid.sectors.Rd pkg/PortfolioAnalytics/man/centroid.sign.Rd pkg/PortfolioAnalytics/man/chart.Concentration.Rd pkg/PortfolioAnalytics/man/chart.EfficientFrontier.Rd pkg/PortfolioAnalytics/man/chart.EfficientFrontierOverlay.Rd pkg/PortfolioAnalytics/man/chart.GroupWeights.Rd pkg/PortfolioAnalytics/man/chart.RiskBudget.Rd pkg/PortfolioAnalytics/man/chart.RiskReward.Rd pkg/PortfolioAnalytics/man/chart.Weights.EF.Rd pkg/PortfolioAnalytics/man/chart.Weights.Rd pkg/PortfolioAnalytics/man/check_constraints.Rd pkg/PortfolioAnalytics/man/cokurtosisMF.Rd pkg/PortfolioAnalytics/man/cokurtosisSF.Rd pkg/PortfolioAnalytics/man/combine.optimizations.Rd pkg/PortfolioAnalytics/man/combine.portfolios.Rd pkg/PortfolioAnalytics/man/constrained_objective.Rd pkg/PortfolioAnalytics/man/constraint.Rd pkg/PortfolioAnalytics/man/constraint_v2.Rd pkg/PortfolioAnalytics/man/coskewnessMF.Rd pkg/PortfolioAnalytics/man/coskewnessSF.Rd pkg/PortfolioAnalytics/man/covarianceMF.Rd pkg/PortfolioAnalytics/man/covarianceSF.Rd pkg/PortfolioAnalytics/man/create.EfficientFrontier.Rd pkg/PortfolioAnalytics/man/diversification.Rd pkg/PortfolioAnalytics/man/diversification_constraint.Rd pkg/PortfolioAnalytics/man/equal.weight.Rd pkg/PortfolioAnalytics/man/etl_milp_opt.Rd pkg/PortfolioAnalytics/man/etl_opt.Rd pkg/PortfolioAnalytics/man/extractCokurtosis.Rd pkg/PortfolioAnalytics/man/extractCoskewness.Rd pkg/PortfolioAnalytics/man/extractCovariance.Rd pkg/PortfolioAnalytics/man/extractEfficientFrontier.Rd pkg/PortfolioAnalytics/man/extractGroups.Rd pkg/PortfolioAnalytics/man/extractObjectiveMeasures.Rd pkg/PortfolioAnalytics/man/extractStats.Rd pkg/PortfolioAnalytics/man/extractWeights.Rd pkg/PortfolioAnalytics/man/factor_exposure_constraint.Rd pkg/PortfolioAnalytics/man/fn_map.Rd pkg/PortfolioAnalytics/man/generatesequence.Rd pkg/PortfolioAnalytics/man/get_constraints.Rd pkg/PortfolioAnalytics/man/gmv_opt.Rd pkg/PortfolioAnalytics/man/gmv_opt_ptc.Rd pkg/PortfolioAnalytics/man/gmv_opt_toc.Rd pkg/PortfolioAnalytics/man/group_constraint.Rd pkg/PortfolioAnalytics/man/group_fail.Rd pkg/PortfolioAnalytics/man/insert_constraints.Rd pkg/PortfolioAnalytics/man/insert_objectives.Rd pkg/PortfolioAnalytics/man/inverse.volatility.weight.Rd pkg/PortfolioAnalytics/man/is.constraint.Rd pkg/PortfolioAnalytics/man/is.objective.Rd pkg/PortfolioAnalytics/man/is.portfolio.Rd pkg/PortfolioAnalytics/man/leverage_exposure_constraint.Rd pkg/PortfolioAnalytics/man/maxret_milp_opt.Rd pkg/PortfolioAnalytics/man/maxret_opt.Rd pkg/PortfolioAnalytics/man/meanetl.efficient.frontier.Rd pkg/PortfolioAnalytics/man/meanvar.efficient.frontier.Rd pkg/PortfolioAnalytics/man/meucci.moments.Rd pkg/PortfolioAnalytics/man/meucci.ranking.Rd pkg/PortfolioAnalytics/man/minmax_objective.Rd pkg/PortfolioAnalytics/man/mult.portfolio.spec.Rd pkg/PortfolioAnalytics/man/name.replace.Rd pkg/PortfolioAnalytics/man/objective.Rd pkg/PortfolioAnalytics/man/optimize.portfolio.Rd pkg/PortfolioAnalytics/man/optimize.portfolio.parallel.Rd pkg/PortfolioAnalytics/man/optimize.portfolio.rebalancing.Rd pkg/PortfolioAnalytics/man/plot.Rd pkg/PortfolioAnalytics/man/portfolio.moments.bl.Rd pkg/PortfolioAnalytics/man/portfolio.moments.boudt.Rd pkg/PortfolioAnalytics/man/portfolio.spec.Rd pkg/PortfolioAnalytics/man/portfolio_risk_objective.Rd pkg/PortfolioAnalytics/man/pos_limit_fail.Rd pkg/PortfolioAnalytics/man/position_limit_constraint.Rd pkg/PortfolioAnalytics/man/print.constraint.Rd pkg/PortfolioAnalytics/man/print.efficient.frontier.Rd pkg/PortfolioAnalytics/man/print.optimize.portfolio.Rd pkg/PortfolioAnalytics/man/print.optimize.portfolio.rebalancing.Rd pkg/PortfolioAnalytics/man/print.portfolio.Rd pkg/PortfolioAnalytics/man/print.summary.optimize.portfolio.Rd pkg/PortfolioAnalytics/man/print.summary.optimize.portfolio.rebalancing.Rd pkg/PortfolioAnalytics/man/quadratic_utility_objective.Rd pkg/PortfolioAnalytics/man/random_portfolios.Rd pkg/PortfolioAnalytics/man/random_portfolios_v1.Rd pkg/PortfolioAnalytics/man/random_walk_portfolios.Rd pkg/PortfolioAnalytics/man/randomize_portfolio.Rd pkg/PortfolioAnalytics/man/randomize_portfolio_v1.Rd pkg/PortfolioAnalytics/man/regime.portfolios.Rd pkg/PortfolioAnalytics/man/return_constraint.Rd pkg/PortfolioAnalytics/man/return_objective.Rd pkg/PortfolioAnalytics/man/risk_budget_objective.Rd pkg/PortfolioAnalytics/man/rp_grid.Rd pkg/PortfolioAnalytics/man/rp_sample.Rd pkg/PortfolioAnalytics/man/rp_simplex.Rd pkg/PortfolioAnalytics/man/rp_transform.Rd pkg/PortfolioAnalytics/man/scatterFUN.Rd pkg/PortfolioAnalytics/man/set.portfolio.moments.Rd pkg/PortfolioAnalytics/man/set.portfolio.moments_v1.Rd pkg/PortfolioAnalytics/man/statistical.factor.model.Rd pkg/PortfolioAnalytics/man/summary.efficient.frontier.Rd pkg/PortfolioAnalytics/man/summary.optimize.portfolio.Rd pkg/PortfolioAnalytics/man/summary.optimize.portfolio.rebalancing.Rd pkg/PortfolioAnalytics/man/summary.portfolio.Rd pkg/PortfolioAnalytics/man/trailingFUN.Rd pkg/PortfolioAnalytics/man/transaction_cost_constraint.Rd pkg/PortfolioAnalytics/man/turnover.Rd pkg/PortfolioAnalytics/man/turnover_constraint.Rd pkg/PortfolioAnalytics/man/turnover_objective.Rd pkg/PortfolioAnalytics/man/update.constraint.Rd pkg/PortfolioAnalytics/man/update_constraint_v1tov2.Rd pkg/PortfolioAnalytics/man/var.portfolio.Rd pkg/PortfolioAnalytics/man/weight_concentration_objective.Rd pkg/PortfolioAnalytics/man/weight_sum_constraint.Rd pkg/PortfolioAnalytics/vignettes/custom_moments_objectives.Rnw Log: more code and documentation cleanup for R CMD check Modified: pkg/PortfolioAnalytics/NAMESPACE =================================================================== --- pkg/PortfolioAnalytics/NAMESPACE 2015-01-25 21:38:09 UTC (rev 3582) +++ pkg/PortfolioAnalytics/NAMESPACE 2015-01-27 03:29:58 UTC (rev 3583) @@ -1,4 +1,4 @@ -# Generated by roxygen2 (4.0.1): do not edit by hand +# Generated by roxygen2 (4.1.0): do not edit by hand S3method(chart.EfficientFrontier,efficient.frontier) S3method(chart.EfficientFrontier,optimize.portfolio) Modified: pkg/PortfolioAnalytics/R/applyFUN.R =================================================================== --- pkg/PortfolioAnalytics/R/applyFUN.R 2015-01-25 21:38:09 UTC (rev 3582) +++ pkg/PortfolioAnalytics/R/applyFUN.R 2015-01-27 03:29:58 UTC (rev 3583) @@ -16,8 +16,8 @@ momentargs <- list() momentargs$mu <- matrix(as.vector(apply(R, 2, "mean")), ncol = 1) momentargs$sigma <- cov(R) - momentargs$m3 <- PerformanceAnalytics:::M3.MM(R) - momentargs$m4 <- PerformanceAnalytics:::M4.MM(R) + momentargs$m3 <- PerformanceAnalytics::M3.MM(R) + momentargs$m4 <- PerformanceAnalytics::M4.MM(R) return(momentargs) } Modified: pkg/PortfolioAnalytics/R/charts.DE.R =================================================================== --- pkg/PortfolioAnalytics/R/charts.DE.R 2015-01-25 21:38:09 UTC (rev 3582) +++ pkg/PortfolioAnalytics/R/charts.DE.R 2015-01-27 03:29:58 UTC (rev 3583) @@ -236,7 +236,7 @@ w = w.traj[i,] x = unlist(constrained_objective(w=w, R=R, portfolio=portfolio, trace=TRUE)) - names(x)<-PortfolioAnalytics:::name.replace(names(x)) + names(x)<-name.replace(names(x)) if(is.null(trajnames)) trajnames<-names(x) if(is.null(rsc)){ rtc = pmatch(return.col,trajnames) @@ -273,7 +273,7 @@ result.slot<-'objective_measures' } objcols<-unlist(object[[result.slot]]) - names(objcols)<-PortfolioAnalytics:::name.replace(names(objcols)) + names(objcols)<-name.replace(names(objcols)) return.column = pmatch(return.col,names(objcols)) if(is.na(return.column)) { return.col = paste(return.col,return.col,sep='.') Modified: pkg/PortfolioAnalytics/R/charts.PSO.R =================================================================== --- pkg/PortfolioAnalytics/R/charts.PSO.R 2015-01-25 21:38:09 UTC (rev 3582) +++ pkg/PortfolioAnalytics/R/charts.PSO.R 2015-01-27 03:29:58 UTC (rev 3583) @@ -165,7 +165,7 @@ result.slot<-'objective_measures' } objcols<-unlist(object[[result.slot]]) - names(objcols)<-PortfolioAnalytics:::name.replace(names(objcols)) + names(objcols)<-name.replace(names(objcols)) return.column = pmatch(return.col,names(objcols)) if(is.na(return.column)) { return.col = paste(return.col,return.col,sep='.') Modified: pkg/PortfolioAnalytics/R/charts.RP.R =================================================================== --- pkg/PortfolioAnalytics/R/charts.RP.R 2015-01-25 21:38:09 UTC (rev 3582) +++ pkg/PortfolioAnalytics/R/charts.RP.R 2015-01-27 03:29:58 UTC (rev 3583) @@ -225,7 +225,7 @@ result.slot<-'objective_measures' } objcols<-unlist(object[[result.slot]]) - names(objcols)<-PortfolioAnalytics:::name.replace(names(objcols)) + names(objcols)<-name.replace(names(objcols)) return.column = pmatch(return.col,names(objcols)) if(is.na(return.column)) { return.col = paste(return.col,return.col,sep='.') Modified: pkg/PortfolioAnalytics/R/charts.efficient.frontier.R =================================================================== --- pkg/PortfolioAnalytics/R/charts.efficient.frontier.R 2015-01-25 21:38:09 UTC (rev 3582) +++ pkg/PortfolioAnalytics/R/charts.efficient.frontier.R 2015-01-27 03:29:58 UTC (rev 3583) @@ -427,11 +427,11 @@ if(!inherits(object, "optimize.portfolio")) stop("object must be of class optimize.portfolio") frontier <- extractEfficientFrontier(object=object, match.col=match.col, n.portfolios=n.portfolios) - PortfolioAnalytics:::chart.Weights.EF(object=frontier, colorset=colorset, ..., - match.col=match.col, by.groups=by.groups, main=main, cex.lab=cex.lab, - cex.axis=cex.axis, cex.legend=cex.legend, - legend.labels=legend.labels, element.color=element.color, - legend.loc=legend.loc) + chart.Weights.EF(object=frontier, colorset=colorset, ..., + match.col=match.col, by.groups=by.groups, main=main, cex.lab=cex.lab, + cex.axis=cex.axis, cex.legend=cex.legend, + legend.labels=legend.labels, element.color=element.color, + legend.loc=legend.loc) } #' @rdname chart.EfficientFrontier Modified: pkg/PortfolioAnalytics/R/extractstats.R =================================================================== --- pkg/PortfolioAnalytics/R/extractstats.R 2015-01-25 21:38:09 UTC (rev 3582) +++ pkg/PortfolioAnalytics/R/extractstats.R 2015-01-27 03:29:58 UTC (rev 3583) @@ -544,7 +544,7 @@ # rbind the objective measures and convert to an xts object #obj <- xts(do.call(rbind, tmp), as.Date(names(tmp.idx))) obj <- do.call(rbind, tmp) - colnames(obj) <- PortfolioAnalytics:::name.replace(colnames(obj)) + colnames(obj) <- name.replace(colnames(obj)) obj <- xts(obj, as.Date(names(tmp.idx))) # insert the objective measures into the list out.list[[unique.regimes[i]]] <- obj @@ -590,7 +590,7 @@ # Get the objective_measures from each element for(i in 1:length(object)){ tmp <- unlist(object[[i]]$objective_measures) - names(tmp) <- PortfolioAnalytics:::name.replace(names(tmp)) + names(tmp) <- name.replace(names(tmp)) obj_list[[opt.names[i]]] <- tmp } obj_names <- unique(unlist(lapply(obj_list, names))) @@ -651,7 +651,7 @@ tmp.R <- object[[i]]$R tmp.portf <- object[[i]]$portfolio tmp <- unlist(constrained_objective(w=tmp.weights, R=tmp.R, portfolio=tmp.portf, trace=TRUE)$objective_measures) - names(tmp) <- PortfolioAnalytics:::name.replace(names(tmp)) + names(tmp) <- name.replace(names(tmp)) out[[opt.names[i]]] <- tmp } out <- do.call(rbind, out) Modified: pkg/PortfolioAnalytics/R/moment.functions.R =================================================================== --- pkg/PortfolioAnalytics/R/moment.functions.R 2015-01-25 21:38:09 UTC (rev 3582) +++ pkg/PortfolioAnalytics/R/moment.functions.R 2015-01-27 03:29:58 UTC (rev 3583) @@ -55,8 +55,8 @@ # set volatility of all U to last observation, such that cov(rescaled U)=sigma uncS = sqrt(diag( cov(U) )) U = U*matrix( rep(nextS/uncS,T ) , ncol = cAssets , byrow = T ) - momentargs$m3 = PerformanceAnalytics:::M3.MM(U) - momentargs$m4 = PerformanceAnalytics:::M4.MM(U) + momentargs$m3 = PerformanceAnalytics::M3.MM(U) + momentargs$m4 = PerformanceAnalytics::M4.MM(U) return(momentargs) } @@ -101,8 +101,8 @@ if(!inherits(cleanR,"try-error")) { momentargs$mu = matrix( as.vector(apply(cleanR,2,'mean')),ncol=1); momentargs$sigma = cov(cleanR); - momentargs$m3 = PerformanceAnalytics:::M3.MM(cleanR) - momentargs$m4 = PerformanceAnalytics:::M4.MM(cleanR) + momentargs$m3 = PerformanceAnalytics::M3.MM(cleanR) + momentargs$m4 = PerformanceAnalytics::M4.MM(cleanR) #' FIXME NOTE: this isn't perfect as it overwrites the moments for all objectives, not just one with clean='boudt' } } @@ -121,8 +121,8 @@ VaR = { if(is.null(momentargs$mu)) momentargs$mu = matrix( as.vector(apply(R,2,'mean')),ncol=1); if(is.null(momentargs$sigma)) momentargs$sigma = cov(R) - if(is.null(momentargs$m3)) momentargs$m3 = PerformanceAnalytics:::M3.MM(R) - if(is.null(momentargs$m4)) momentargs$m4 = PerformanceAnalytics:::M4.MM(R) + if(is.null(momentargs$m3)) momentargs$m3 = PerformanceAnalytics::M3.MM(R) + if(is.null(momentargs$m4)) momentargs$m4 = PerformanceAnalytics::M4.MM(R) }, es =, mES =, @@ -131,8 +131,8 @@ ES = { if(is.null(momentargs$mu)) momentargs$mu = matrix( as.vector(apply(R,2,'mean')),ncol=1); if(is.null(momentargs$sigma)) momentargs$sigma = cov(R) - if(is.null(momentargs$m3)) momentargs$m3 = PerformanceAnalytics:::M3.MM(R) - if(is.null(momentargs$m4)) momentargs$m4 = PerformanceAnalytics:::M4.MM(R) + if(is.null(momentargs$m3)) momentargs$m3 = PerformanceAnalytics::M3.MM(R) + if(is.null(momentargs$m4)) momentargs$m4 = PerformanceAnalytics::M4.MM(R) } ) # end switch on objectives } @@ -286,8 +286,8 @@ sample = { if(is.null(momentargs$mu)) momentargs$mu = matrix( as.vector(apply(tmpR, 2, 'mean')), ncol=1); if(is.null(momentargs$sigma)) momentargs$sigma = cov(tmpR) - if(is.null(momentargs$m3)) momentargs$m3 = PerformanceAnalytics:::M3.MM(tmpR) - if(is.null(momentargs$m4)) momentargs$m4 = PerformanceAnalytics:::M4.MM(tmpR) + if(is.null(momentargs$m3)) momentargs$m3 = PerformanceAnalytics::M3.MM(tmpR) + if(is.null(momentargs$m4)) momentargs$m4 = PerformanceAnalytics::M4.MM(tmpR) }, boudt = { if(is.null(momentargs$mu)) momentargs$mu = matrix( as.vector(apply(tmpR, 2, 'mean')), ncol=1); @@ -298,14 +298,14 @@ black_litterman = { if(is.null(momentargs$mu)) momentargs$mu = B$BLMu if(is.null(momentargs$sigma)) momentargs$sigma = B$BLSigma - if(is.null(momentargs$m3)) momentargs$m3 = PerformanceAnalytics:::M3.MM(tmpR) - if(is.null(momentargs$m4)) momentargs$m4 = PerformanceAnalytics:::M4.MM(tmpR) + if(is.null(momentargs$m3)) momentargs$m3 = PerformanceAnalytics::M3.MM(tmpR) + if(is.null(momentargs$m4)) momentargs$m4 = PerformanceAnalytics::M4.MM(tmpR) }, meucci = { if(is.null(momentargs$mu)) momentargs$mu = meucci.model$mu if(is.null(momentargs$sigma)) momentargs$sigma = meucci.model$sigma - if(is.null(momentargs$m3)) momentargs$m3 = PerformanceAnalytics:::M3.MM(tmpR) - if(is.null(momentargs$m4)) momentargs$m4 = PerformanceAnalytics:::M4.MM(tmpR) + if(is.null(momentargs$m3)) momentargs$m3 = PerformanceAnalytics::M3.MM(tmpR) + if(is.null(momentargs$m4)) momentargs$m4 = PerformanceAnalytics::M4.MM(tmpR) } ) # end nested switch on method }, # end switch on mVaR, VaR @@ -324,8 +324,8 @@ sample = { if(is.null(momentargs$mu)) momentargs$mu = matrix( as.vector(apply(tmpR, 2, 'mean')), ncol=1); if(is.null(momentargs$sigma)) momentargs$sigma = cov(tmpR) - if(is.null(momentargs$m3)) momentargs$m3 = PerformanceAnalytics:::M3.MM(tmpR) - if(is.null(momentargs$m4)) momentargs$m4 = PerformanceAnalytics:::M4.MM(tmpR) + if(is.null(momentargs$m3)) momentargs$m3 = PerformanceAnalytics::M3.MM(tmpR) + if(is.null(momentargs$m4)) momentargs$m4 = PerformanceAnalytics::M4.MM(tmpR) }, boudt = { if(is.null(momentargs$mu)) momentargs$mu = matrix( as.vector(apply(tmpR, 2, 'mean')), ncol=1); @@ -336,14 +336,14 @@ black_litterman = { if(is.null(momentargs$mu)) momentargs$mu = B$BLMu if(is.null(momentargs$sigma)) momentargs$sigma = B$BLSigma - if(is.null(momentargs$m3)) momentargs$m3 = PerformanceAnalytics:::M3.MM(tmpR) - if(is.null(momentargs$m4)) momentargs$m4 = PerformanceAnalytics:::M4.MM(tmpR) + if(is.null(momentargs$m3)) momentargs$m3 = PerformanceAnalytics::M3.MM(tmpR) + if(is.null(momentargs$m4)) momentargs$m4 = PerformanceAnalytics::M4.MM(tmpR) }, meucci = { if(is.null(momentargs$mu)) momentargs$mu = meucci.model$mu if(is.null(momentargs$sigma)) momentargs$sigma = meucci.model$sigma - if(is.null(momentargs$m3)) momentargs$m3 = PerformanceAnalytics:::M3.MM(tmpR) - if(is.null(momentargs$m4)) momentargs$m4 = PerformanceAnalytics:::M4.MM(tmpR) + if(is.null(momentargs$m3)) momentargs$m3 = PerformanceAnalytics::M3.MM(tmpR) + if(is.null(momentargs$m4)) momentargs$m4 = PerformanceAnalytics::M4.MM(tmpR) } ) # end nested switch on method } @@ -364,8 +364,8 @@ momentargs$mu<-mu_ts[last(index(R)),] momentargs$sigma<-covlist[as.character(last(index(R)))] - if(is.null(momentargs$m3)) momentargs$m3 = PerformanceAnalytics:::M3.MM(R) - if(is.null(momentargs$m4)) momentargs$m4 = PerformanceAnalytics:::M4.MM(R) + if(is.null(momentargs$m3)) momentargs$m3 = PerformanceAnalytics::M3.MM(R) + if(is.null(momentargs$m4)) momentargs$m4 = PerformanceAnalytics::M4.MM(R) return(momentargs) } @@ -509,8 +509,8 @@ VaR = { if(is.null(momentargs$mu)) momentargs$mu = B$BLMu if(is.null(momentargs$sigma)) momentargs$sigma = B$BLSigma - if(is.null(momentargs$m3)) momentargs$m3 = PerformanceAnalytics:::M3.MM(R) - if(is.null(momentargs$m4)) momentargs$m4 = PerformanceAnalytics:::M4.MM(R) + if(is.null(momentargs$m3)) momentargs$m3 = PerformanceAnalytics::M3.MM(R) + if(is.null(momentargs$m4)) momentargs$m4 = PerformanceAnalytics::M4.MM(R) }, es =, mES =, @@ -525,8 +525,8 @@ if(!ROI){ if(is.null(momentargs$mu)) momentargs$mu = B$BLMu if(is.null(momentargs$sigma)) momentargs$sigma = B$BLSigma - if(is.null(momentargs$m3)) momentargs$m3 = PerformanceAnalytics:::M3.MM(R) - if(is.null(momentargs$m4)) momentargs$m4 = PerformanceAnalytics:::M4.MM(R) + if(is.null(momentargs$m3)) momentargs$m3 = PerformanceAnalytics::M3.MM(R) + if(is.null(momentargs$m4)) momentargs$m4 = PerformanceAnalytics::M4.MM(R) } } ) # end switch on objectives Modified: pkg/PortfolioAnalytics/R/mult.layer.portfolio.R =================================================================== --- pkg/PortfolioAnalytics/R/mult.layer.portfolio.R 2015-01-25 21:38:09 UTC (rev 3582) +++ pkg/PortfolioAnalytics/R/mult.layer.portfolio.R 2015-01-27 03:29:58 UTC (rev 3583) @@ -147,8 +147,8 @@ } # This needs to support anything in ... that could be passed to optimize.portfolio .formals <- formals(optimize.portfolio.rebalancing) - .formals <- PortfolioAnalytics:::modify.args(formals=.formals, arglist=NULL, R=R, dots=TRUE) - .formals <- PortfolioAnalytics:::modify.args(formals=.formals, arglist=tmp, dots=TRUE) + .formals <- modify.args(formals=.formals, arglist=NULL, R=R, dots=TRUE) + .formals <- modify.args(formals=.formals, arglist=tmp, dots=TRUE) .formals$... <- NULL #print(.formals) opt <- try(do.call(optimize.portfolio.rebalancing, .formals), silent=TRUE) Modified: pkg/PortfolioAnalytics/R/stat.factor.model.R =================================================================== --- pkg/PortfolioAnalytics/R/stat.factor.model.R 2015-01-25 21:38:09 UTC (rev 3582) +++ pkg/PortfolioAnalytics/R/stat.factor.model.R 2015-01-27 03:29:58 UTC (rev 3583) @@ -514,7 +514,7 @@ # Factor moments # f.centered <- center(f) # factorM3 <- M3.MM(f.centered) - factorM3 <- PerformanceAnalytics:::M3.MM(f) + factorM3 <- PerformanceAnalytics::M3.MM(f) # Compute covariance estimate if(k == 1){ @@ -562,7 +562,7 @@ factorM2 <- cov(f) # f.centered <- center(f) # factorM4 <- M4.MM(f.centered) - factorM4 <- PerformanceAnalytics:::M4.MM(f) + factorM4 <- PerformanceAnalytics::M4.MM(f) # Compute covariance estimate if(k == 1){ Modified: pkg/PortfolioAnalytics/man/BlackLittermanFormula.Rd =================================================================== --- pkg/PortfolioAnalytics/man/BlackLittermanFormula.Rd 2015-01-25 21:38:09 UTC (rev 3582) +++ pkg/PortfolioAnalytics/man/BlackLittermanFormula.Rd 2015-01-27 03:29:58 UTC (rev 3583) @@ -1,4 +1,5 @@ -% Generated by roxygen2 (4.0.1): do not edit by hand +% Generated by roxygen2 (4.1.0): do not edit by hand +% Please edit documentation in R/black_litterman.R \name{BlackLittermanFormula} \alias{BlackLittermanFormula} \title{Computes the Black-Litterman formula for the moments of the posterior normal.} Modified: pkg/PortfolioAnalytics/man/CCCgarch.MM.Rd =================================================================== --- pkg/PortfolioAnalytics/man/CCCgarch.MM.Rd 2015-01-25 21:38:09 UTC (rev 3582) +++ pkg/PortfolioAnalytics/man/CCCgarch.MM.Rd 2015-01-27 03:29:58 UTC (rev 3583) @@ -1,4 +1,5 @@ -% Generated by roxygen2 (4.0.1): do not edit by hand +% Generated by roxygen2 (4.1.0): do not edit by hand +% Please edit documentation in R/moment.functions.R \name{CCCgarch.MM} \alias{CCCgarch.MM} \title{compute comoments for use by lower level optimization functions when the conditional covariance matrix is a CCC GARCH model} Modified: pkg/PortfolioAnalytics/man/EntropyProg.Rd =================================================================== --- pkg/PortfolioAnalytics/man/EntropyProg.Rd 2015-01-25 21:38:09 UTC (rev 3582) +++ pkg/PortfolioAnalytics/man/EntropyProg.Rd 2015-01-27 03:29:58 UTC (rev 3583) @@ -1,4 +1,5 @@ -% Generated by roxygen2 (4.0.1): do not edit by hand +% Generated by roxygen2 (4.1.0): do not edit by hand +% Please edit documentation in R/EntropyProg.R \name{EntropyProg} \alias{EntropyProg} \title{Entropy pooling program for blending views on scenarios with a prior scenario-probability distribution} @@ -8,14 +9,14 @@ \arguments{ \item{p}{a vector of initial probabilities based on prior (reference model, empirical distribution, etc.). Sum of 'p' must be 1} +\item{A}{matrix consisting of inequality constraints (paired with argument 'b'). Denoted as 'F' in the Meucci paper} + +\item{b}{vector consisting of inequality constraints (paired with matrix A). Denoted as 'f' in the Meucci paper} + \item{Aeq}{matrix consisting of equality constraints (paired with argument 'beq'). Denoted as 'H' in the Meucci paper. (denoted as 'H' in the "Meucci - Flexible Views Theory & Practice" paper formlua 86 on page 22)} \item{beq}{vector corresponding to the matrix of equality constraints (paired with argument 'Aeq'). Denoted as 'h' in the Meucci paper} -\item{A}{matrix consisting of inequality constraints (paired with argument 'b'). Denoted as 'F' in the Meucci paper} - -\item{b}{vector consisting of inequality constraints (paired with matrix A). Denoted as 'f' in the Meucci paper} - \item{verbose}{If TRUE, prints out additional information. Default FALSE. ' \deqn{ \tilde{p} \equiv argmin_{Fx \leq f, Hx \equiv h} \big\{ \sum_1^J x_{j} \big(ln \big( x_{j} \big) - ln \big( p_{j} \big) \big) \big\} Modified: pkg/PortfolioAnalytics/man/HHI.Rd =================================================================== --- pkg/PortfolioAnalytics/man/HHI.Rd 2015-01-25 21:38:09 UTC (rev 3582) +++ pkg/PortfolioAnalytics/man/HHI.Rd 2015-01-27 03:29:58 UTC (rev 3583) @@ -1,4 +1,5 @@ -% Generated by roxygen2 (4.0.1): do not edit by hand +% Generated by roxygen2 (4.1.0): do not edit by hand +% Please edit documentation in R/objectiveFUN.R \name{HHI} \alias{HHI} \title{Concentration of weights} Modified: pkg/PortfolioAnalytics/man/ac.ranking.Rd =================================================================== --- pkg/PortfolioAnalytics/man/ac.ranking.Rd 2015-01-25 21:38:09 UTC (rev 3582) +++ pkg/PortfolioAnalytics/man/ac.ranking.Rd 2015-01-27 03:29:58 UTC (rev 3583) @@ -1,4 +1,5 @@ -% Generated by roxygen2 (4.0.1): do not edit by hand +% Generated by roxygen2 (4.1.0): do not edit by hand +% Please edit documentation in R/ac_ranking.R \name{ac.ranking} \alias{ac.ranking} \title{Asset Ranking} Modified: pkg/PortfolioAnalytics/man/add.constraint.Rd =================================================================== --- pkg/PortfolioAnalytics/man/add.constraint.Rd 2015-01-25 21:38:09 UTC (rev 3582) +++ pkg/PortfolioAnalytics/man/add.constraint.Rd 2015-01-27 03:29:58 UTC (rev 3583) @@ -1,4 +1,5 @@ -% Generated by roxygen2 (4.0.1): do not edit by hand +% Generated by roxygen2 (4.1.0): do not edit by hand +% Please edit documentation in R/constraints.R \name{add.constraint} \alias{add.constraint} \title{General interface for adding and/or updating optimization constraints.} @@ -15,9 +16,9 @@ \item{message}{TRUE/FALSE. The default is message=FALSE. Display messages if TRUE.} +\item{indexnum}{if you are updating a specific constraint, the index number in the $constraints list to update} + \item{\dots}{any other passthru parameters to specify constraints} - -\item{indexnum}{if you are updating a specific constraint, the index number in the $constraints list to update} } \description{ This is the main function for adding and/or updating constraints to the \code{\link{portfolio.spec}} object. @@ -58,16 +59,20 @@ pspec <- add.constraint(portfolio=pspec, type="box", min=0.05, max=0.4) # min and max can also be specified per asset -pspec <- add.constraint(portfolio=pspec, type="box", min=c(0.05, 0, 0.08, 0.1), max=c(0.4, 0.3, 0.7, 0.55)) +pspec <- add.constraint(portfolio=pspec, type="box", min=c(0.05, 0, 0.08, 0.1), + max=c(0.4, 0.3, 0.7, 0.55)) # A special case of box constraints is long only where min=0 and max=1 # The default action is long only if min and max are not specified pspec <- add.constraint(portfolio=pspec, type="box") pspec <- add.constraint(portfolio=pspec, type="long_only") # Add group constraints -pspec <- add.constraint(portfolio=pspec, type="group", groups=list(c(1, 2, 1), 4), group_min=c(0.1, 0.15), group_max=c(0.85, 0.55), group_labels=c("GroupA", "GroupB"), group_pos=c(2, 1)) +pspec <- add.constraint(portfolio=pspec, type="group", groups=list(c(1, 2, 1), 4), + group_min=c(0.1, 0.15), group_max=c(0.85, 0.55), + group_labels=c("GroupA", "GroupB"), group_pos=c(2, 1)) -# Add position limit constraint such that we have a maximum number of three assets with non-zero weights. +# Add position limit constraint such that we have a maximum number of three +# assets with non-zero weights. pspec <- add.constraint(portfolio=pspec, type="position_limit", max_pos=3) # Add diversification constraint Modified: pkg/PortfolioAnalytics/man/add.objective.Rd =================================================================== --- pkg/PortfolioAnalytics/man/add.objective.Rd 2015-01-25 21:38:09 UTC (rev 3582) +++ pkg/PortfolioAnalytics/man/add.objective.Rd 2015-01-27 03:29:58 UTC (rev 3583) @@ -1,4 +1,5 @@ -% Generated by roxygen2 (4.0.1): do not edit by hand +% Generated by roxygen2 (4.1.0): do not edit by hand +% Please edit documentation in R/objective.R \name{add.objective} \alias{add.objective} \alias{add.objective_v1} @@ -15,8 +16,6 @@ enabled = TRUE, ..., indexnum = NULL) } \arguments{ -\item{portfolio}{an object of type 'portfolio' to add the objective to, specifying the portfolio for the optimization, see \code{\link{portfolio}}} - \item{constraints}{a 'v1_constraint' object for backwards compatibility, see \code{\link{constraint}}} \item{type}{character type of the objective to add or update, currently 'return','risk', 'risk_budget', 'quadratic_utility', or 'weight_concentration'} @@ -27,9 +26,11 @@ \item{enabled}{TRUE/FALSE} +\item{indexnum}{if you are updating a specific objective, the index number in the $objectives list to update} + +\item{portfolio}{an object of type 'portfolio' to add the objective to, specifying the portfolio for the optimization, see \code{\link{portfolio}}} + \item{\dots}{any other passthru parameters} - -\item{indexnum}{if you are updating a specific objective, the index number in the $objectives list to update} } \description{ This function is the main function for adding and updating business objectives in an object of type \code{\link{portfolio.spec}}. Modified: pkg/PortfolioAnalytics/man/add.sub.portfolio.Rd =================================================================== --- pkg/PortfolioAnalytics/man/add.sub.portfolio.Rd 2015-01-25 21:38:09 UTC (rev 3582) +++ pkg/PortfolioAnalytics/man/add.sub.portfolio.Rd 2015-01-27 03:29:58 UTC (rev 3583) @@ -1,4 +1,5 @@ -% Generated by roxygen2 (4.0.1): do not edit by hand +% Generated by roxygen2 (4.1.0): do not edit by hand +% Please edit documentation in R/mult.layer.portfolio.R \name{add.sub.portfolio} \alias{add.sub.portfolio} \title{Add sub-portfolio} @@ -29,12 +30,12 @@ (i.e. width of the moving or rolling window), the default is NULL will run using the returns data from inception} -\item{\dots}{additonal passthrough parameters to \code{\link{optimize.portfolio.rebalancing}}} - \item{indexnum}{the index number of the sub portfolio. If \code{indexnum=NULL} (the default), then the sub portfolio object is appended to the list of sub portfolios in the \code{mult.portfolio} object. If \code{indexnum} is specified, the portfolio in that index number is overwritten.} + +\item{\dots}{additonal passthrough parameters to \code{\link{optimize.portfolio.rebalancing}}} } \description{ Add a sub-portfolio to a multiple layer portfolio specification object Modified: pkg/PortfolioAnalytics/man/applyFUN.Rd =================================================================== --- pkg/PortfolioAnalytics/man/applyFUN.Rd 2015-01-25 21:38:09 UTC (rev 3582) +++ pkg/PortfolioAnalytics/man/applyFUN.Rd 2015-01-27 03:29:58 UTC (rev 3583) @@ -1,4 +1,5 @@ -% Generated by roxygen2 (4.0.1): do not edit by hand +% Generated by roxygen2 (4.1.0): do not edit by hand +% Please edit documentation in R/applyFUN.R \name{applyFUN} \alias{applyFUN} \title{Apply a risk or return function to a set of weights} Modified: pkg/PortfolioAnalytics/man/barplotGroupWeights.Rd =================================================================== --- pkg/PortfolioAnalytics/man/barplotGroupWeights.Rd 2015-01-25 21:38:09 UTC (rev 3582) +++ pkg/PortfolioAnalytics/man/barplotGroupWeights.Rd 2015-01-27 03:29:58 UTC (rev 3583) @@ -1,4 +1,5 @@ -% Generated by roxygen2 (4.0.1): do not edit by hand +% Generated by roxygen2 (4.1.0): do not edit by hand +% Please edit documentation in R/charts.groups.R \name{barplotGroupWeights} \alias{barplotGroupWeights} \title{barplot of group weights by group or category} Modified: pkg/PortfolioAnalytics/man/black.litterman.Rd =================================================================== --- pkg/PortfolioAnalytics/man/black.litterman.Rd 2015-01-25 21:38:09 UTC (rev 3582) +++ pkg/PortfolioAnalytics/man/black.litterman.Rd 2015-01-27 03:29:58 UTC (rev 3583) @@ -1,4 +1,5 @@ -% Generated by roxygen2 (4.0.1): do not edit by hand +% Generated by roxygen2 (4.1.0): do not edit by hand +% Please edit documentation in R/black_litterman.R \name{black.litterman} \alias{black.litterman} \title{Black Litterman Estimates} Modified: pkg/PortfolioAnalytics/man/box_constraint.Rd =================================================================== --- pkg/PortfolioAnalytics/man/box_constraint.Rd 2015-01-25 21:38:09 UTC (rev 3582) +++ pkg/PortfolioAnalytics/man/box_constraint.Rd 2015-01-27 03:29:58 UTC (rev 3583) @@ -1,4 +1,5 @@ -% Generated by roxygen2 (4.0.1): do not edit by hand +% Generated by roxygen2 (4.1.0): do not edit by hand +% Please edit documentation in R/constraints.R \name{box_constraint} \alias{box_constraint} \title{constructor for box_constraint.} @@ -45,7 +46,8 @@ pspec <- add.constraint(pspec, type="box", min=0.05, max=0.45) # specify box constraints per asset -pspec <- add.constraint(pspec, type="box", min=c(0.05, 0.10, 0.08, 0.06), max=c(0.45, 0.55, 0.35, 0.65)) +pspec <- add.constraint(pspec, type="box", min=c(0.05, 0.10, 0.08, 0.06), + max=c(0.45, 0.55, 0.35, 0.65)) } \author{ Ross Bennett Modified: pkg/PortfolioAnalytics/man/center.Rd =================================================================== --- pkg/PortfolioAnalytics/man/center.Rd 2015-01-25 21:38:09 UTC (rev 3582) +++ pkg/PortfolioAnalytics/man/center.Rd 2015-01-27 03:29:58 UTC (rev 3583) @@ -1,4 +1,5 @@ -% Generated by roxygen2 (4.0.1): do not edit by hand +% Generated by roxygen2 (4.1.0): do not edit by hand +% Please edit documentation in R/stat.factor.model.R \name{center} \alias{center} \title{Center} Modified: pkg/PortfolioAnalytics/man/centroid.buckets.Rd =================================================================== --- pkg/PortfolioAnalytics/man/centroid.buckets.Rd 2015-01-25 21:38:09 UTC (rev 3582) +++ pkg/PortfolioAnalytics/man/centroid.buckets.Rd 2015-01-27 03:29:58 UTC (rev 3583) @@ -1,4 +1,5 @@ -% Generated by roxygen2 (4.0.1): do not edit by hand +% Generated by roxygen2 (4.1.0): do not edit by hand +% Please edit documentation in R/ac_ranking.R \name{centroid.buckets} \alias{centroid.buckets} \title{Buckets Centroid} Modified: pkg/PortfolioAnalytics/man/centroid.complete.mc.Rd =================================================================== --- pkg/PortfolioAnalytics/man/centroid.complete.mc.Rd 2015-01-25 21:38:09 UTC (rev 3582) +++ pkg/PortfolioAnalytics/man/centroid.complete.mc.Rd 2015-01-27 03:29:58 UTC (rev 3583) @@ -1,4 +1,5 @@ -% Generated by roxygen2 (4.0.1): do not edit by hand +% Generated by roxygen2 (4.1.0): do not edit by hand +% Please edit documentation in R/ac_ranking.R \name{centroid.complete.mc} \alias{centroid.complete.mc} \title{Complete Cases Centroid} Modified: pkg/PortfolioAnalytics/man/centroid.sectors.Rd =================================================================== --- pkg/PortfolioAnalytics/man/centroid.sectors.Rd 2015-01-25 21:38:09 UTC (rev 3582) +++ pkg/PortfolioAnalytics/man/centroid.sectors.Rd 2015-01-27 03:29:58 UTC (rev 3583) @@ -1,4 +1,5 @@ -% Generated by roxygen2 (4.0.1): do not edit by hand +% Generated by roxygen2 (4.1.0): do not edit by hand +% Please edit documentation in R/ac_ranking.R \name{centroid.sectors} \alias{centroid.sectors} \title{Multiple Sectors Centroid} Modified: pkg/PortfolioAnalytics/man/centroid.sign.Rd =================================================================== --- pkg/PortfolioAnalytics/man/centroid.sign.Rd 2015-01-25 21:38:09 UTC (rev 3582) +++ pkg/PortfolioAnalytics/man/centroid.sign.Rd 2015-01-27 03:29:58 UTC (rev 3583) @@ -1,4 +1,5 @@ -% Generated by roxygen2 (4.0.1): do not edit by hand +% Generated by roxygen2 (4.1.0): do not edit by hand +% Please edit documentation in R/ac_ranking.R \name{centroid.sign} \alias{centroid.sign} \title{Positive and Negative View Centroid} Modified: pkg/PortfolioAnalytics/man/chart.Concentration.Rd =================================================================== --- pkg/PortfolioAnalytics/man/chart.Concentration.Rd 2015-01-25 21:38:09 UTC (rev 3582) +++ pkg/PortfolioAnalytics/man/chart.Concentration.Rd 2015-01-27 03:29:58 UTC (rev 3583) @@ -1,4 +1,5 @@ -% Generated by roxygen2 (4.0.1): do not edit by hand +% Generated by roxygen2 (4.1.0): do not edit by hand +% Please edit documentation in R/chart.concentration.R \name{chart.Concentration} \alias{chart.Concentration} \title{Classic risk reward scatter and concentration} @@ -11,8 +12,6 @@ \arguments{ \item{object}{optimal portfolio created by \code{\link{optimize.portfolio}}.} -\item{\dots}{any other passthru parameters.} - \item{return.col}{string matching the objective of a 'return' objective, on vertical axis.} \item{risk.col}{string matching the objective of a 'risk' objective, on horizontal axis.} @@ -32,6 +31,8 @@ \item{xlim}{set the x-axis limit, same as in \code{\link{plot}}.} \item{ylim}{set the y-axis limit, same as in \code{\link{plot}}.} + +\item{\dots}{any other passthru parameters.} } \description{ This function charts the \code{optimize.portfolio} object in risk-return space Modified: pkg/PortfolioAnalytics/man/chart.EfficientFrontier.Rd =================================================================== --- pkg/PortfolioAnalytics/man/chart.EfficientFrontier.Rd 2015-01-25 21:38:09 UTC (rev 3582) +++ pkg/PortfolioAnalytics/man/chart.EfficientFrontier.Rd 2015-01-27 03:29:58 UTC (rev 3583) @@ -1,4 +1,5 @@ -% Generated by roxygen2 (4.0.1): do not edit by hand [TRUNCATED] To get the complete diff run: svnlook diff /svnroot/returnanalytics -r 3583 From noreply at r-forge.r-project.org Tue Jan 27 04:32:37 2015 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Tue, 27 Jan 2015 04:32:37 +0100 (CET) Subject: [Returnanalytics-commits] r3584 - pkg/PortfolioAnalytics/vignettes Message-ID: <20150127033237.2A531186F81@r-forge.r-project.org> Author: rossbennett34 Date: 2015-01-27 04:32:36 +0100 (Tue, 27 Jan 2015) New Revision: 3584 Removed: pkg/PortfolioAnalytics/vignettes/portfolio_vignette.Rnw pkg/PortfolioAnalytics/vignettes/portfolio_vignette.pdf Log: Temporarily removing portfolio_vignette. The code in the vignette runs fine, but the pdf throws an error when being built. Deleted: pkg/PortfolioAnalytics/vignettes/portfolio_vignette.Rnw =================================================================== --- pkg/PortfolioAnalytics/vignettes/portfolio_vignette.Rnw 2015-01-27 03:29:58 UTC (rev 3583) +++ pkg/PortfolioAnalytics/vignettes/portfolio_vignette.Rnw 2015-01-27 03:32:36 UTC (rev 3584) @@ -1,679 +0,0 @@ -\documentclass[a4paper]{article} -\usepackage[OT1]{fontenc} -\usepackage{Sweave} -\usepackage{Rd} -\usepackage{amsmath} -\usepackage{hyperref} - -\usepackage[round]{natbib} -\usepackage{bm} -\usepackage{verbatim} -\usepackage[latin1]{inputenc} -\bibliographystyle{abbrvnat} - -\usepackage{url} - -\let\proglang=\textsf -%\newcommand{\pkg}[1]{{\fontseries{b}\selectfont #1}} -%\newcommand{\R}[1]{{\fontseries{b}\selectfont #1}} -%\newcommand{\email}[1]{\href{mailto:#1}{\normalfont\texttt{#1}}} -%\newcommand{\E}{\mathsf{E}} -%\newcommand{\VAR}{\mathsf{VAR}} -%\newcommand{\COV}{\mathsf{COV}} -%\newcommand{\Prob}{\mathsf{P}} - -\renewcommand{\topfraction}{0.85} -\renewcommand{\textfraction}{0.1} -\renewcommand{\baselinestretch}{1.5} -\setlength{\textwidth}{15cm} \setlength{\textheight}{22cm} \topmargin-1cm \evensidemargin0.5cm \oddsidemargin0.5cm - -\usepackage[latin1]{inputenc} -% or whatever - -\usepackage{lmodern} -\usepackage[T1]{fontenc} -% Or whatever. Note that the encoding and the font should match. If T1 -% does not look nice, try deleting the line with the fontenc. - -% \VignetteIndexEntry{An Introduction to Portfolio Optimization with PortfolioAnalytics} - -\begin{document} - -\title{Introduction to PortfolioAnalytics} -\author{Ross Bennett} - -\maketitle - -\begin{abstract} -The purpose of this vignette is to demonstrate the new interface in PortfolioAnalytics to specify a portfolio object, add constraints and objectis, and run optimizations. -\end{abstract} - -\tableofcontents - -\section{Getting Started} -\subsection{Load Packages} -Load the necessary packages. - -<<>>= -library(PortfolioAnalytics) -@ - -\subsection{Data} -The edhec data set from the PerformanceAnalytics package will be used as example data. -<<>>= -data(edhec) - -# Use the first 4 columns in edhec for a returns object -returns <- edhec[, 1:4] -colnames(returns) <- c("CA", "CTAG", "DS", "EM") -print(head(returns, 5)) - -# Get a character vector of the fund names -fund.names <- colnames(returns) -@ - -\section{Creating the Portfolio Object} -The portfolio object is instantiated with the \code{portfolio.spec} function. The main argument to \code{portfolio.spec} is assets, this is a required argument. The assets argument can be a scalar value for the number of assets, a character vector of fund names, or a named vector of initial weights. If initial weights are not specified, an equal weight portfolio will be assumed. - -The \code{pspec} object is an S3 object of class "portfolio". When first created, the portfolio object has an element named \code{assets} with the initial weights, an element named \code{category\_labels}, an element named \code{weight\_seq} with sequence of weights if specified, an empty constraints list and an empty objectives list. - -<<>>= -# Specify a portfolio object by passing a character vector for the -# assets argument. -pspec <- portfolio.spec(assets=fund.names) -print.default(pspec) -@ - -\section{Adding Constraints to the Portfolio Object} -Adding constraints to the portfolio object is done with \code{add.constraint}. The \code{add.constraint} function is the main interface for adding and/or updating constraints to the portfolio object. This function allows the user to specify the portfolio to add the constraints to, the type of constraints, arguments for the constraint, and whether or not to enable the constraint (\code{enabled=TRUE} is the default). If updating an existing constraint, the indexnum argument can be specified. - -\subsection{Sum of Weights Constraint} - -The \code{weight_sum} constraint specifies the constraint on the sum of the weights. Aliases for the \code{weight\_sum} constraint type include \code{weight} and \code{leverage}. Here we add a constraint that the weights must sum to 1, or the full investment constraint. -<>= -# Add the full investment constraint that specifies the weights must sum to 1. -pspec <- add.constraint(portfolio=pspec, - type="weight_sum", - min_sum=1, - max_sum=1) -@ - -There are two special cases for the leverage constraint: -\begin{enumerate} -\item The sum of the weights equal 1, i.e. the full investment constraint. The full investment constraint can be specified with \code{type="full\_investment"}. This automatically sets \code{min\_sum=1} and \code{max\_sum=1.} -\item The sum of the weights equal 0, i.e. the dollar neutral or active constraint. This constraint can be specified with \code{type="dollar\_neutral"} or \code{type="active"}. -\end{enumerate} - -<>= -# The full investment constraint can also be specified with type="full_investment" -# pspec <- add.constraint(portfolio=pspec, type="full_investment") - -# Another common constraint is that portfolio weights sum to 0. -# This can be specified any of the following ways -# pspec <- add.constraint(portfolio=pspec, type="weight_sum", -# min_sum=0, -# max_sum=0) -# pspec <- add.constraint(portfolio=pspec, type="dollar_neutral") -# pspec <- add.constraint(portfolio=pspec, type="active") -@ - -\subsection{Box Constraint} -Box constraints allows the user to specify upper and lower bounds on the weights of the assets. Here we add box constraints for the asset weights so that the minimum weight of any asset must be greater than or equal to 0.05 and the maximum weight of any asset must be less than or equal to 0.4. The values for min and max can be passed in as scalars or vectors. If min and max are scalars, the values for min and max will be replicated as vectors to the length of assets. If min and max are not specified, a minimum weight of 0 and maximum weight of 1 are assumed. Note that min and max can be specified as vectors with different weights for linear inequality constraints. -<>= -# Add box constraints -pspec <- add.constraint(portfolio=pspec, - type="box", - min=0.05, - max=0.4) - -# min and max can also be specified per asset -# pspec <- add.constraint(portfolio=pspec, -# type="box", -# min=c(0.05, 0, 0.08, 0.1), -# max=c(0.4, 0.3, 0.7, 0.55)) - -# A special case of box constraints is long only where min=0 and max=1 -# The default action is long only if min and max are not specified -# pspec <- add.constraint(portfolio=pspec, type="box") -# pspec <- add.constraint(portfolio=pspec, type="long_only") -@ - - -\subsection{Group Constraint} -Group constraints allow the user to specify the the sum of weights by group. Group constraints are currently supported by the ROI, DEoptim, and random portfolio solvers. The following code groups the assets such that the first 3 assets are grouped together labeled GroupA and the fourth asset is in its own group labeled GroupB. The \code{group\_min} argument specifies that the sum of the weights in GroupA must be greater than or equal to 0.1 and the sum of the weights in GroupB must be greater than or equal to 0.15. The \code{group\_max} argument specifies that the sum of the weights in GroupA must be less than or equal to 0.85 and the sum of the weights in GroupB must be less than or equal to 0.55.The \code{group\_labels} argument is optional and is useful if groups is not a named list for labeling groups in terms of market capitalization, sector, etc. -<>= -# Add group constraints -pspec <- add.constraint(portfolio=pspec, type="group", - groups=list(groupA=c(1, 2, 3), - grouB=4), - group_min=c(0.1, 0.15), - group_max=c(0.85, 0.55)) -@ - -\subsection{Position Limit Constraint} -The position limit constraint allows the user to specify limits on the number of assets with non-zero, long, or short positions. The ROI solver interfaces to the Rglpk package (i.e. using the glpk plugin) for solving maximizing return and ETL/ES/cVaR objectives. The Rglpk package supports integer programming and thus supports position limit constraints for the \code{max\_pos} argument. The quadprog package does not support integer programming, and therefore \code{max\_pos} is not supported for the ROI solver using the quadprog plugin. Note that \code{max\_pos\_long} and \code{max\_pos\_short} are not supported for either ROI solver. All position limit constraints are fully supported for DEoptim and random solvers. - -<>= -# Add position limit constraint such that we have a maximum number of three assets with non-zero weights. -pspec <- add.constraint(portfolio=pspec, type="position_limit", max_pos=3) - -# Can also specify maximum number of long positions and short positions -# pspec <- add.constraint(portfolio=pspec, type="position_limit", max_pos_long=3, max_pos_short=3) -@ - -\subsection{Diversification Constraint} -The diversification constraint allows the user to target diversification. Diversification is defined as $diversification = \sum_{i=1}^N w_i^2$ for $N$ assets. The diversification constraint is implemented for the global optimizers by applying a penalty if the diversification value is more than 5\% away from \code{div\_target}. Note that diversification as a constraint is not supported for the ROI solvers, it is only supported for the global numeric solvers. -<<>>= -pspec <- add.constraint(portfolio=pspec, type="diversification", div_target=0.7) -@ - -\subsection{Turnover Constraint} -A target turnover can be specified as a constraint. The turnover is calculated from a set of initial weights. The initial weights can be specified, by default they are the initial weights in the portfolio object. The turnover constraint is implemented for the global optimizers by applying a penalty if the turnover value is more than 5\% away from \code{turnover\_target}. Note that the turnover constraint is not currently supported for quadratic utility and minimum variance problems using the ROI solver. -<<>>= -pspec <- add.constraint(portfolio=pspec, type="turnover", turnover_target=0.2) -@ - -\subsection{Target Return Constraint} -The target return constraint allows the user to specify a target mean return. -<<>>= -pspec <- add.constraint(portfolio=pspec, type="return", return_target=0.007) -@ - -\subsection{Factor Exposure Constraint} -The factor exposure constraint allows the user to set upper and lower bounds on exposures to risk factors. The exposures can be passed in as a vector or matrix. Here we specify a vector for \code{B} with arbitrary values, e.g. betas of the assets, with a market risk exposure range of 0.6 to 0.9. -<>= -pspec <- add.constraint(portfolio=pspec, type="factor_exposure", - B=c(-0.08, 0.37, 0.79, 1.43), - lower=0.6, upper=0.9) -@ - -\subsection{Transaction Cost Constraint} -The transaction cost constraint allows the user to specify proportional transaction costs. Proportional transaction cost constraints can be implemented for quadratic utility and minimum variance problems using the ROI solver. Transaction costs are supported as a penalty for the global numeric solvers. Here we add the transaction cost contraint with the proportional transaction cost value of 1\%. -<<>>= -pspec <- add.constraint(portfolio=pspec, type="transaction_cost", ptc=0.01) -@ - -The print method for the portfolio object shows a concise view of the portfolio and the constraints that have been added. -<<>>= -print(pspec) -@ - -The summary method gives a more detailed view of the constraints. -<<>>= -summary(pspec) -@ - -This demonstrates adding constraints to the portfolio object. As an alternative to adding constraints directly to the portfolio object, constraints can be specified as separate objects. - -\subsection{Specifying Constraints as Separate Objects} -The following examples will demonstrate how to specify constraints as separate objects for all constraints types. - -<>= -# full investment constraint -weight_constr <- weight_sum_constraint(min_sum=1, max_sum=1) - -# box constraint -box_constr <- box_constraint(assets=pspec$assets, min=0, max=1) - -# group constraint -group_constr <- group_constraint(assets=pspec$assets, - groups=list(c(1, 2, 3), - 4), - group_min=c(0.1, 0.15), - group_max=c(0.85, 0.55), - group_labels=c("GroupA", "GroupB")) - -# position limit constraint -poslimit_constr <- position_limit_constraint(assets=pspec$assets, max_pos=3) - -# diversification constraint -div_constr <- diversification_constraint(div_target=0.7) - -# turnover constraint -to_constr <- turnover_constraint(turnover_target=0.2) - -# target return constraint -ret_constr <- return_constraint(return_target=0.007) - -# factor exposure constraint -exp_constr <- factor_exposure_constraint(assets=pspec$assets, - B=c(-0.08, 0.37, 0.79, 1.43), - lower=0.6, upper=0.9) - -# transaction cost constraint -ptc_constr <- transaction_cost_constraint(assets=pspec$assets, ptc=0.01) -@ - -\section{Adding Objectives} -Objectives can be added to the portfolio object with \code{add.objective}. The \code{add.objective} function is the main function for adding and/or updating business objectives to the portfolio object. This function allows the user to specify the \verb"portfolio" to add the objectives to, the \verb"type" (currently 'return', 'risk', 'risk\_budget', or 'weight\_concentration'), \verb"name" of the objective function, \verb"arguments" to the objective function, and whether or not to \verb"enable" the objective. If updating an existing constraint, the \verb"indexnum" argument can be specified. - -\subsection{Portfolio Risk Objective} -The portfolio risk objective allows the user to specify a risk function to minimize -Here we add a risk objective to minimize portfolio expected tail loss with a confidence level of 0.95. Other default arguments to the function can be passed in as a named list to arguments. Note that the name of the function must correspond to a function in R. Many functions are available in the \verb"PerformanceAnalytics" package or a user defined function. -<>= -pspec <- add.objective(portfolio=pspec, - type='risk', - name='ETL', - arguments=list(p=0.95)) -@ - -\subsection{Portfolio Return Objective} -The return objective allows the user to specify a return function to maximize. Here we add a return objective to maximize the portfolio mean return. -<>= -pspec <- add.objective(portfolio=pspec, - type='return', - name='mean') -@ - -\subsection{Portfolio Risk Budget Objective} -The portfolio risk objective allows the user to specify constraints to minimize component contribution (i.e. equal risk contribution) or specify upper and lower bounds on percentage risk contribution. Here we specify that no asset can contribute more than 30\% to total portfolio risk. See the risk budget optimization vignette for more detailed examples of portfolio optimizations with risk budgets. -<>= -pspec <- add.objective(portfolio=pspec, type="risk_budget", name="ETL", - arguments=list(p=0.95), max_prisk=0.3) - -# for an equal risk contribution portfolio, set min_concentration=TRUE -# pspec <- add.objective(portfolio=pspec, type="risk_budget", name="ETL", -# arguments=list(p=0.95), min_concentration=TRUE) -@ - - -\subsection{Portfolio Weight Concentration Objective} -The weight concentration objective allows the user to specify an objective to minimize concentration as measured by the Herfindahl-Hirschman Index. For otpimization problems solved with the global numeric optimizers, the portfolio HHI value is penalized using \code{conc\_aversion} value as the multiplier. - -For quadratic utility problems with weight concentration as an objective using the ROI solver, this is implemented as a penalty to the objective function. The objective function is implemented as follows: - -\begin{eqnarray} -\underset{\boldsymbol{w}}{\text{maximize}} -\boldsymbol{w}' \boldsymbol{\mu} - \frac{\lambda}{2}(\boldsymbol{w}' \boldsymbol{\Sigma} \boldsymbol{w} + \lambda_{hhi} * HHI)\\ -\end{eqnarray} -Where $\mu$ is the estimated mean asset returns, $\lambda$ is the risk aversion parameter, $lambda_{hhi}$ is the concentration aversion parameter, $HHI$ is the portfolio $HHI$, $\boldsymbol{\Sigma}$ is the estimated covariance matrix of asset returns and $\boldsymbol{w}$ is the set of weights. - -Here we add a weight concentration objective for the overall portfolio HHI. -<>= -pspec <- add.objective(portfolio=pspec, type="weight_concentration", - name="HHI", conc_aversion=0.1) -@ - -The weight concentration aversion parameter by groups can also be specified. Here we add a weight concentration objective specifying groups and concentration aversion parameters by group. -<>= -pspec <- add.objective(portfolio=pspec, type="weight_concentration", - name="HHI", - conc_aversion=c(0.03, 0.06), - conc_groups=list(c(1, 2), - c(3, 4))) -@ - -The print method for the portfolio object will now show all the constraints and objectives that have been added. -<<>>= -print(pspec) -@ - -The \code{summary} function gives a more detailed view. -<<>>= -summary(pspec) -@ - -\section{Solvers} -The PortfolioAnalytics package currently supports random portfolios, DEoptim, pso, GenSA, and ROI as back ends. Note that some of the QP/LP problems are solved directly with Rglpk and quadprog. The solver can be specified with the \code{optimize\_method} argument in \code{optimize.portfolio} and \code{optimize.portfolio.rebalancing}. - -\subsection{DEoptim} -PortfolioAnalytics uses the \code{DEoptim} function from the R package \verb"DEoptim". Differential evolution is a stochastic global optimization algorithm. See \code{?DEoptim} and the references contained therein for more information. See also \href{http://cran.r-project.org/web/packages/DEoptim/vignettes/DEoptimPortfolioOptimization.pdf}{Large scale portfolio optimization with DEoptim}. -\subsection{Random Portfolios} -PortfolioAnalytics has three methods to generate random portfolios. -\begin{enumerate} -\item The 'sample' method to generate random portfolios is based on an idea by Pat Burns. This is the most flexible method, but also the slowest, and can generate portfolios to satisfy leverage, box, group, and position limit constraints. -\item The 'simplex' method to generate random portfolios is based on a paper by W. T. Shaw. The simplex method is useful to generate random portfolios with the full investment constraint, where the sum of the weights is equal to 1, and min box constraints. Values for \code{min\_sum} and \code{max\_sum} of the leverage constraint will be ignored, the sum of weights will equal 1. All other constraints such as the box constraint max, group and position limit constraints will be handled by elimination. If the constraints are very restrictive, this may result in very few feasible portfolios remaining. Another key point to note is that the solution may not be along the vertexes depending on the objective. For example, a risk budget objective will likely place the portfolio somewhere on the interior. -\item The 'grid' method to generate random portfolios is based on the \code{gridSearch} function in package \verb"NMOF". The grid search method only satisfies the \code{min} and \code{max} box constraints. The \code{min\_sum} and \code{max\_sum} leverage constraint will likely be violated and the weights in the random portfolios should be normalized. Normalization may cause the box constraints to be violated and will be penalized in \code{constrained\_objective}. -\end{enumerate} - -The following plots illustrate the various methods to generate random portfolios. - -<>= -R <- edhec[, 1:4] - -# set up simple portfolio with leverage and box constraints -pspec <- portfolio.spec(assets=colnames(R)) -pspec <- add.constraint(portfolio=pspec, type="leverage", - min_sum=0.99, max_sum=1.01) -pspec <- add.constraint(portfolio=pspec, type="box", min=0, max=1) - -# generate random portfolios using the 3 methods -rp1 <- random_portfolios(portfolio=pspec, permutations=5000, - rp_method='sample') -rp2 <- random_portfolios(portfolio=pspec, permutations=5000, - rp_method='simplex') -rp3 <- random_portfolios(portfolio=pspec, permutations=5000, - rp_method='grid') - -# show feasible portfolios in mean-StdDev space -tmp1.mean <- apply(rp1, 1, function(x) mean(R %*% x)) -tmp1.StdDev <- apply(rp1, 1, function(x) StdDev(R=R, weights=x)) -tmp2.mean <- apply(rp2, 1, function(x) mean(R %*% x)) -tmp2.StdDev <- apply(rp2, 1, function(x) StdDev(R=R, weights=x)) -tmp3.mean <- apply(rp3, 1, function(x) mean(R %*% x)) -tmp3.StdDev <- apply(rp3, 1, function(x) StdDev(R=R, weights=x)) - -# plot feasible portfolios -plot(x=tmp1.StdDev, y=tmp1.mean, col="gray", main="Random Portfolio Methods", - ylab="mean", xlab="StdDev") -points(x=tmp2.StdDev, y=tmp2.mean, col="red", pch=2) -points(x=tmp3.StdDev, y=tmp3.mean, col="lightgreen", pch=5) -legend("bottomright", legend=c("sample", "simplex", "grid"), - col=c("gray", "red", "lightgreen"), - pch=c(1, 2, 5), bty="n") -@ - -Figure 1 shows the feasible space using the different random portfolio methods. The 'sample' method has relatively even coverage of the feasible space. The 'simplex' method also has relatively even coverage of the space, but it is also more concentrated around the assets. The 'grid' method is pushed to the interior of the space due to the normalization. - -The \code{fev} argument controls the face-edge-vertex biasing. Higher values for \code{fev} will result in the weights vector more concentrated on a single asset. This can be seen in the following charts. -<>= -fev <- 0:5 -par(mfrow=c(2, 3)) -for(i in 1:length(fev)){ - rp <- rp_simplex(portfolio=pspec, permutations=2000, fev=fev[i]) - tmp.mean <- apply(rp, 1, function(x) mean(R %*% x)) - tmp.StdDev <- apply(rp, 1, function(x) StdDev(R=R, weights=x)) - plot(x=tmp.StdDev, y=tmp.mean, main=paste("FEV =", fev[i]), - ylab="mean", xlab="StdDev", col=rgb(0, 0, 100, 50, maxColorValue=255)) -} -par(mfrow=c(1,1)) -@ - -Figure 2 shows the feasible space varying the fev values. - -The \code{fev} argument can be passed in as a vector for more control over the coverage of the feasible space. The default value is \code{fev=0:5}. -<>= -par(mfrow=c(1, 2)) -# simplex -rp_simplex <- random_portfolios(portfolio=pspec, permutations=2000, - rp_method='simplex') -tmp.mean <- apply(rp_simplex, 1, function(x) mean(R %*% x)) -tmp.StdDev <- apply(rp_simplex, 1, function(x) StdDev(R=R, weights=x)) -plot(x=tmp.StdDev, y=tmp.mean, main="rp_method=simplex fev=0:5", - ylab="mean", xlab="StdDev", col=rgb(0, 0, 100, 50, maxColorValue=255)) -#sample -rp_sample <- random_portfolios(portfolio=pspec, permutations=2000, - rp_method='sample') -tmp.mean <- apply(rp_sample, 1, function(x) mean(R %*% x)) -tmp.StdDev <- apply(rp_sample, 1, function(x) StdDev(R=R, weights=x)) -plot(x=tmp.StdDev, y=tmp.mean, main="rp_method=sample", - ylab="mean", xlab="StdDev", col=rgb(0, 0, 100, 50, maxColorValue=255)) -par(mfrow=c(1,1)) -@ - -\subsection{pso} -PortfolioAnalytics uses the \code{psoptim} function from the R package \verb"pso". Particle swarm optimization is a heuristic optimization algorithm. See \code{?psoptim} and the references contained therein for more information. - -\subsection{GenSA} -PortfolioAnalytics uses the \code{GenSA} function from the R package \verb"GenSA". Generalized simmulated annealing is generic probabilistic heuristic optimization algorithm. See \code{?GenSA} and the references contained therein for more information. - -\subsection{ROI} -The \verb"ROI" package serves as an interface to the \verb"Rglpk" package and the \verb"quadprog" package to solve linear and quadratic programming problems. The interface to the \verb"ROI" package solves a limited type of convex optimization problems: - -\begin{enumerate} -\item Maxmimize portfolio return subject leverage, box, group, position limit, target mean return, and/or factor exposure constraints on weights. -\item Minimize portfolio variance subject to leverage, box, group, turnover, and/or factor exposure constraints (otherwise known as global minimum variance portfolio). -\item Minimize portfolio variance subject to leverage, box, group, and/or factor exposure constraints and a desired portfolio return. -\item Maximize quadratic utility subject to leverage, box, group, target mean return, turnover, and/or factor exposure constraints and risk aversion parameter. -(The risk aversion parameter is passed into \code{optimize.portfolio} as an added argument to the \code{portfolio} object). -\item Minimize ETL subject to leverage, box, group, position limit, target mean return, and/or factor exposure constraints and target portfolio return. -\end{enumerate} - - -\section{Optimization} -The previous sections demonstrated how to specify a portfolio object, add constraints, add objectives, and the solvers available. This section will demonstrate run the optimizations via \code{optimize.portfolio}. Only a small number of examples will be shown here, see the demos for several more examples. - -\subsection{Initial Portfolio Object} -<<>>= -library(DEoptim) -library(ROI) -require(ROI.plugin.glpk) -require(ROI.plugin.quadprog) - -data(edhec) -R <- edhec[, 1:6] -colnames(R) <- c("CA", "CTAG", "DS", "EM", "EQMN", "ED") -funds <- colnames(R) - -# Create an initial portfolio object with leverage and box constraints -init <- portfolio.spec(assets=funds) -init <- add.constraint(portfolio=init, type="leverage", - min_sum=0.99, max_sum=1.01) -init <- add.constraint(portfolio=init, type="box", min=0.05, max=0.65) -@ - -\subsection{Maximize mean return with ROI} -Add an objective to maximize mean return. -<<>>= -maxret <- add.objective(portfolio=init, type="return", name="mean") -@ - -Run the optimization. -<>= -opt_maxret <- optimize.portfolio(R=R, portfolio=maxret, - optimize_method="ROI", - trace=TRUE) - -print(opt_maxret) -@ - -Chart the weights and optimal portfolio in risk-return space. The weights and a risk-reward scatter plot can be plotted separately as shown below with the \code{chart.Weights} and \code{chart.RiskReward} functions. The \code{plot} function will plot the weights and risk-reward scatter together. -<>= -plot(opt_maxret, risk.col="StdDev", return.col="mean", - main="Maximum Return Optimization", chart.assets=TRUE, - xlim=c(0, 0.05), ylim=c(0,0.0085)) -@ - -\subsection{Minimize variance with ROI} -Add an objective to minimize portfolio variance. -<<>>= -minvar <- add.objective(portfolio=init, type="risk", name="var") -@ - -Run the optimization. Note that although 'var' is the risk metric, 'StdDev' is returned as an objective measure. -<>= -opt_minvar <- optimize.portfolio(R=R, portfolio=minvar, - optimize_method="ROI", trace=TRUE) -print(opt_minvar) -@ - -Chart the weights and optimal portfolio in risk-return space. -<>= -plot(opt_minvar, risk.col="StdDev", return.col="mean", - main="Minimum Variance Optimization", chart.assets=TRUE, - xlim=c(0, 0.05), ylim=c(0,0.0085)) -@ - -\subsection{Maximize quadratic utility with ROI} -Add mean and var objectives for quadratic utility. Note that the risk aversion parameter for quadratic utility is specifed in the objective as shown below. -<<>>= -qu <- add.objective(portfolio=init, type="return", name="mean") -qu <- add.objective(portfolio=qu, type="risk", name="var", risk_aversion=0.25) -@ - -Run the optimization. -<>= -opt_qu <- optimize.portfolio(R=R, portfolio=qu, - optimize_method="ROI", - trace=TRUE) -print(opt_qu) -@ - -<>= -plot(opt_qu, risk.col="StdDev", return.col="mean", - main="Quadratic Utility Optimization", chart.assets=TRUE, - xlim=c(0, 0.05), ylim=c(0, 0.0085)) -@ - -\subsection{Minimize expected tail loss with ROI} -Add ETL objective. -<<>>= -etl <- add.objective(portfolio=init, type="risk", name="ETL") -@ - -Run the optimization. -<>= -opt_etl <- optimize.portfolio(R=R, portfolio=etl, - optimize_method="ROI", - trace=TRUE) -print(opt_etl) -@ - -<>= -plot(opt_etl, risk.col="ES", return.col="mean", - main="ETL Optimization", chart.assets=TRUE, - xlim=c(0, 0.14), ylim=c(0,0.0085)) -@ - -\subsection{Maximize mean return per unit ETL with random portfolios} -Add mean and ETL objectives. -<>= -meanETL <- add.objective(portfolio=init, type="return", name="mean") -meanETL <- add.objective(portfolio=meanETL, type="risk", name="ETL", - arguments=list(p=0.95)) -@ - -Run the optimization. The default random portfolio method is 'sample'. -<>= -opt_meanETL <- optimize.portfolio(R=R, portfolio=meanETL, - optimize_method="random", - trace=TRUE, search_size=2000) -print(opt_meanETL) -@ - -The optimization was run with \code{trace=TRUE} so that iterations and other output from random portfolios is stored in the \code{opt\_meanETL} object. The \code{extractStats} function can be used to get a matrix of the weights and objective measures at each iteration. -<<>>= -stats_meanETL <- extractStats(opt_meanETL) -dim(stats_meanETL) -head(stats_meanETL) -@ - -Chart the optimal weights and optimal portfolio in risk-return space. Because the optimization was run with \code{trace=TRUE}, the chart of the optimal portfolio also includes the trace portfolios of the optimization. This is usefule to visualize the feasible space of the portfolios. The 'neighbor' portfolios relative to the optimal portfolio weights can be included the chart of the optimal weights. -<>= -plot(opt_meanETL, risk.col="ETL", return.col="mean", - main="mean-ETL Optimization", neighbors=25) -@ - -Calculate and plot the portfolio component ETL contribution. -<>= -pct_contrib <- ES(R=R, p=0.95, portfolio_method="component", - weights=extractWeights(opt_meanETL)) -barplot(pct_contrib$pct_contrib_MES, cex.names=0.8, las=3, col="lightblue") -@ - -This figure shows that the Equity Market Nuetral strategy has greater than 50\% risk contribution. A risk budget objective can be added to limit risk contribution percentage to 40\%. - -\subsection{Maximize mean return per unit ETL with ETL risk budgets} -Add objectives to maximize mean return per unit ETL with 40\% limit ETL risk budgets. -<>= -# change the box constraints to long only -init$constraints[[2]]$min <- rep(0, 6) -init$constraints[[2]]$max <- rep(1, 6) - -rb_meanETL <- add.objective(portfolio=init, type="return", name="mean") -rb_meanETL <- add.objective(portfolio=rb_meanETL, type="risk", name="ETL", - arguments=list(p=0.95)) -rb_meanETL <- add.objective(portfolio=rb_meanETL, type="risk_budget", - name="ETL", max_prisk=0.4, arguments=list(p=0.95)) -@ - -Run the optimization. Set \code{traceDE=5} so that every fifth iteration is printed. The default is to print every iteration. -<>= -opt_rb_meanETL <- optimize.portfolio(R=R, portfolio=rb_meanETL, - optimize_method="DEoptim", - search_size=2000, - trace=TRUE, traceDE=5) -print(opt_rb_meanETL) -@ - [TRUNCATED] To get the complete diff run: svnlook diff /svnroot/returnanalytics -r 3584 From noreply at r-forge.r-project.org Tue Jan 27 04:53:20 2015 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Tue, 27 Jan 2015 04:53:20 +0100 (CET) Subject: [Returnanalytics-commits] r3585 - pkg/PortfolioAnalytics Message-ID: <20150127035320.2DF27184220@r-forge.r-project.org> Author: rossbennett34 Date: 2015-01-27 04:53:19 +0100 (Tue, 27 Jan 2015) New Revision: 3585 Modified: pkg/PortfolioAnalytics/DESCRIPTION Log: Adding Authors at R field and bumping version number Modified: pkg/PortfolioAnalytics/DESCRIPTION =================================================================== --- pkg/PortfolioAnalytics/DESCRIPTION 2015-01-27 03:32:36 UTC (rev 3584) +++ pkg/PortfolioAnalytics/DESCRIPTION 2015-01-27 03:53:19 UTC (rev 3585) @@ -2,10 +2,17 @@ Type: Package Title: Portfolio Analysis, including Numerical Methods for Optimization of Portfolios -Version: 0.9.3581 +Authors at R: c( + person(given=c("Brian","G."),family="Peterson",role=c("cre","aut","cph"), email="brian at braverock.com") + , person(given="Peter",family="Carl",role=c("aut","cph"), email="peter at braverock.com") + , person(given="Kris",family="Boudt",role=c("ctb","cph")) + , person(given="Ross",family="Bennett",role=c("ctb","cph")) + , person(given="Hezky",family="Varon",role="ctb") + , person(given="Guy",family="Yollin",role="ctb") + , person(given="R. Douglas",family="Martin",role="ctb") + ) +Version: 0.9.3585 Date: $Date$ -Author: Brian G. Peterson, Peter Carl, Ross Bennett, Kris Boudt -Contributors: R. Douglas Martin, Guy Yollin, Hezky Varon Maintainer: Brian G. Peterson Description: Portfolio optimization and analysis routines and graphics. Depends: From noreply at r-forge.r-project.org Tue Jan 27 09:34:39 2015 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Tue, 27 Jan 2015 09:34:39 +0100 (CET) Subject: [Returnanalytics-commits] r3586 - in pkg/FactorAnalytics: R man vignettes Message-ID: <20150127083439.3AD631878DF@r-forge.r-project.org> Author: pragnya Date: 2015-01-27 09:34:38 +0100 (Tue, 27 Jan 2015) New Revision: 3586 Modified: pkg/FactorAnalytics/R/fitTsfm.R pkg/FactorAnalytics/man/fitTsfm.Rd pkg/FactorAnalytics/vignettes/fitTsfm_vignette.R pkg/FactorAnalytics/vignettes/fitTsfm_vignette.Rnw pkg/FactorAnalytics/vignettes/fitTsfm_vignette.pdf Log: Update to HM model in fitTsfm Modified: pkg/FactorAnalytics/R/fitTsfm.R =================================================================== --- pkg/FactorAnalytics/R/fitTsfm.R 2015-01-27 03:53:19 UTC (rev 3585) +++ pkg/FactorAnalytics/R/fitTsfm.R 2015-01-27 08:34:38 UTC (rev 3586) @@ -39,13 +39,14 @@ #' factors to be added to any of the above methods. Market timing accounts for #' the price movement of the general stock market relative to fixed income #' securities. Specifying \code{mkt.timing="HM"}, includes -#' $up.market = max(0, R_m-R_f)$ as a factor, followinhg Henriksson & Merton -#' (1981). The coefficient of this up-market factor can be interpreted as the -#' number of free put options. Similarly, to account for market timing with -#' respect to volatility, one can specify \code{mkt.timing="TM"}. Following -#' Treynor & Mazuy (1966), $market.sqd = (R_m-R_f)^2$ is added as a factor. To -#' include both these market-timing factors in the model, one can specify -#' \code{mkt.timing=c("HM","TM")}. +#' $down.market = max(0, R_f-R_m)$ as a factor, following Henriksson & Merton +#' (1981). The coefficient of this down-market factor can be interpreted as the +#' number of "free" put options on the market provided by the manager's +#' market-timings kills. Similarly, to account for market timing with respect +#' to volatility, one can specify \code{mkt.timing="TM"}. Following +#' Treynor & Mazuy (1966), $market.sqd = (R_m-R_f)^2$ is added as a factor. +#' For example, as a test for market timing, either of these factors can be +#' added to the single index regression model. #' #' \subsection{Data Processing}{ #' @@ -74,7 +75,7 @@ #' See details. Default is "OLS". #' @param variable.selection the variable selection method, one of "none", #' "stepwise","subsets","lars". See details. Default is "none". -#' @param mkt.timing one of "HM", "TM" or "both". See Details. Default is NULL. +#' @param mkt.timing one of "HM" or "TM". See Details. Default is NULL. #' \code{mkt.name} is required if any of these options are to be implemented. #' @param control list of control parameters. The default is constructed by #' the function \code{\link{fitTsfm.control}}. See the documentation for @@ -245,13 +246,13 @@ warning("Excess returns were not computed.") } - # opt add mkt-timing factors: up.market=max(0,Rm-Rf), market.sqd=(Rm-Rf)^2 + # opt add mkt-timing factors: down.market=max(0,Rf-Rm), market.sqd=(Rm-Rf)^2 if("HM" %in% mkt.timing) { - up.market <- data.xts[,mkt.name] - up.market [up.market < 0] <- 0 - dat.xts <- merge.xts(dat.xts,up.market) - colnames(dat.xts)[dim(dat.xts)[2]] <- "up.market" - factor.names <- c(factor.names, "up.market") + down.market <- data.xts[,mkt.name] + down.market [down.market > 0] <- 0 + dat.xts <- merge.xts(dat.xts,down.market) + colnames(dat.xts)[dim(dat.xts)[2]] <- "down.market" + factor.names <- c(factor.names, "down.market") } if("TM" %in% mkt.timing) { market.sqd <- data.xts[,mkt.name]^2 Modified: pkg/FactorAnalytics/man/fitTsfm.Rd =================================================================== --- pkg/FactorAnalytics/man/fitTsfm.Rd 2015-01-27 03:53:19 UTC (rev 3585) +++ pkg/FactorAnalytics/man/fitTsfm.Rd 2015-01-27 08:34:38 UTC (rev 3586) @@ -40,7 +40,7 @@ \item{variable.selection}{the variable selection method, one of "none", "stepwise","subsets","lars". See details. Default is "none".} -\item{mkt.timing}{one of "HM", "TM" or "both". See Details. Default is NULL. +\item{mkt.timing}{one of "HM" or "TM". See Details. Default is NULL. \code{mkt.name} is required if any of these options are to be implemented.} \item{control}{list of control parameters. The default is constructed by @@ -122,13 +122,14 @@ factors to be added to any of the above methods. Market timing accounts for the price movement of the general stock market relative to fixed income securities. Specifying \code{mkt.timing="HM"}, includes -$up.market = max(0, R_m-R_f)$ as a factor, followinhg Henriksson & Merton -(1981). The coefficient of this up-market factor can be interpreted as the -number of free put options. Similarly, to account for market timing with -respect to volatility, one can specify \code{mkt.timing="TM"}. Following -Treynor & Mazuy (1966), $market.sqd = (R_m-R_f)^2$ is added as a factor. To -include both these market-timing factors in the model, one can specify -\code{mkt.timing=c("HM","TM")}. +$down.market = max(0, R_f-R_m)$ as a factor, following Henriksson & Merton +(1981). The coefficient of this down-market factor can be interpreted as the +number of "free" put options on the market provided by the manager's +market-timings kills. Similarly, to account for market timing with respect +to volatility, one can specify \code{mkt.timing="TM"}. Following +Treynor & Mazuy (1966), $market.sqd = (R_m-R_f)^2$ is added as a factor. +For example, as a test for market timing, either of these factors can be +added to the single index regression model. \subsection{Data Processing}{ Modified: pkg/FactorAnalytics/vignettes/fitTsfm_vignette.R =================================================================== --- pkg/FactorAnalytics/vignettes/fitTsfm_vignette.R 2015-01-27 03:53:19 UTC (rev 3585) +++ pkg/FactorAnalytics/vignettes/fitTsfm_vignette.R 2015-01-27 08:34:38 UTC (rev 3586) @@ -44,9 +44,12 @@ ## ------------------------------------------------------------------------ # Henriksson-Merton's market timing model -fit.mktTiming <- fitTsfm(asset.names=asset.names, rf.name="US 3m TR", - mkt.name="SP500 TR", mkt.timing="HM", data=managers) -fit.mktTiming +fit.mktTiming <- fitTsfm(asset.names=asset.names, factor.names="SP500 TR", + rf.name="US 3m TR", mkt.name="SP500 TR", + mkt.timing="HM", data=managers) +fit.mktTiming$beta +fit.mktTiming$r2 +fit.mktTiming$resid.sd ## ------------------------------------------------------------------------ @@ -193,7 +196,8 @@ ## ## Selection: -## ----fig.cap="Actual and fitted factor model returns for the 1st 4 assets"---- +## ----fig.cap="Actual and fitted factor model returns for the 1st 4 assets", fig.show='asis', fig.width=7, fig.height=6---- +# Example of a group plot: looping disabled & no. of assets displayed = 4. plot(fit.sub, which.plot.group=3, max.show=4, legend.loc=NULL, loop=FALSE) @@ -219,17 +223,17 @@ ## ## Selection: -## ----fig.cap="Time series plot of residuals with standard error bands: HAM1", fig.show='hold'---- +## ----fig.cap="Time series plot of residuals with standard error bands: HAM1", fig.show='asis', fig.width=7, fig.height=4.5---- plot(fit.sub, plot.single=TRUE, asset.name="HAM1", which.plot.single=2, loop=FALSE) -## ----fig.cap="SACF and PACF of absolute residuals: HAM1", fig.show='hold'---- +## ----fig.cap="SACF and PACF of absolute residuals: HAM1", fig.show='asis', fig.width=7, fig.height=4.5---- plot(fit.sub, plot.single=TRUE, asset.name="HAM1", which.plot.single=7, loop=FALSE) -## ----fig.cap="Histogram of residuals with normal curve overlayed for HAM1", fig.show='hold'---- +## ----fig.cap="Histogram of residuals with normal curve overlayed for HAM1", fig.show='asis', fig.width=7, fig.height=4.5---- plot(fit.sub, plot.single=TRUE, asset.name="HAM1", which.plot.single=8, loop=FALSE) Modified: pkg/FactorAnalytics/vignettes/fitTsfm_vignette.Rnw =================================================================== --- pkg/FactorAnalytics/vignettes/fitTsfm_vignette.Rnw 2015-01-27 03:53:19 UTC (rev 3585) +++ pkg/FactorAnalytics/vignettes/fitTsfm_vignette.Rnw 2015-01-27 08:34:38 UTC (rev 3586) @@ -148,15 +148,18 @@ \subsection{Market Timing Models} -In the following example, we fit the \citet{henriksson1981market} market timing model, using the SP500 as the market. Market timing accounts for the price movement of the general stock market relative to fixed income securities. Specifying \code{mkt.timing="HM"}, includes $up.market = max(0, R_m-R_f)$ as a factor. +In the following example, we fit the \citet{henriksson1981market} market timing model, using the SP500 as the market. Market timing accounts for the price movement of the general stock market relative to fixed income securities. Specifying \code{mkt.timing="HM"}, includes $down.market = max(0, R_f-R_m)$ as a factor. To test market timing ability, this factor can be added to the single index model as shown below. The coefficient of this down-market factor can be interpreted as the number of "free" put options on the market provided by the manager's market-timings kills. That is, a negative value for the regression estimate would imply a negative value for market timing ability of the manager. <<>>= # Henriksson-Merton's market timing model -fit.mktTiming <- fitTsfm(asset.names=asset.names, rf.name="US 3m TR", - mkt.name="SP500 TR", mkt.timing="HM", data=managers) -fit.mktTiming +fit.mktTiming <- fitTsfm(asset.names=asset.names, factor.names="SP500 TR", + rf.name="US 3m TR", mkt.name="SP500 TR", + mkt.timing="HM", data=managers) +fit.mktTiming$beta +fit.mktTiming$r2 +fit.mktTiming$resid.sd @ -Similarly, to account for market timing with respect to volatility, one can specify \code{mkt.timing="TM"}. Following \citet{treynor1966can}, $market.sqd = (R_m-R_f)^2$ is added as a factor. To include both these market-timing factors in the model, one can specify \code{mkt.timing=c("HM","TM")}. +Similarly, to account for market timing with respect to volatility, one can specify \code{mkt.timing="TM"}. Following \citet{treynor1966can}, $market.sqd = (R_m-R_f)^2$ is added as a factor. Note that, the user needs to specify which of the columns in \code{data} corresponds to the market returns using argument \code{mkt.name}. In the above case, \code{factor.names} were left out from the argument list and a pure market-timing model was fit. @@ -171,7 +174,7 @@ fit.ols$resid.sd @ -Other options include discounted least squares (\code{"DLS"}) and robust regression (\code{"Robust"}). DLS is least squares regression using exponentially discounted weights and accounts for time variation in coefficients. Robust regression is resistant to outliers and heteroskedasticity. +Other options include discounted least squares (\code{"DLS"}) and robust regression (\code{"Robust"}). DLS is least squares regression using exponentially discounted weights and accounts for time variation in coefficients. Robust regression is resistant to outliers. <<>>= fit.robust <- fitTsfm(asset.names=asset.names, factor.names=factor.names, rf.name="US 3m TR", data=managers, fit.method="Robust") Modified: pkg/FactorAnalytics/vignettes/fitTsfm_vignette.pdf =================================================================== (Binary files differ) From noreply at r-forge.r-project.org Tue Jan 27 09:36:37 2015 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Tue, 27 Jan 2015 09:36:37 +0100 (CET) Subject: [Returnanalytics-commits] r3587 - pkg/FactorAnalytics Message-ID: <20150127083637.BB2D718793A@r-forge.r-project.org> Author: pragnya Date: 2015-01-27 09:36:37 +0100 (Tue, 27 Jan 2015) New Revision: 3587 Modified: pkg/FactorAnalytics/DESCRIPTION Log: Update to HM model in fitTsfm Modified: pkg/FactorAnalytics/DESCRIPTION =================================================================== --- pkg/FactorAnalytics/DESCRIPTION 2015-01-27 08:34:38 UTC (rev 3586) +++ pkg/FactorAnalytics/DESCRIPTION 2015-01-27 08:36:37 UTC (rev 3587) @@ -1,8 +1,8 @@ Package: factorAnalytics Type: Package Title: Factor Analytics -Version: 2.0.9 -Date: 2014-12-07 +Version: 2.0.10 +Date: 2015-01-27 Author: Eric Zivot, Sangeetha Srinivasan and Yi-An Chen Maintainer: Sangeetha Srinivasan Description: An R package for the estimation and risk analysis of linear factor