Ranjit Mishra's Posts - Data Science Central2020-02-19T11:50:56ZRanjit Mishrahttps://www.datasciencecentral.com/profile/RanjitMishrahttps://storage.ning.com/topology/rest/1.0/file/get/2800434959?profile=RESIZE_48X48&width=48&height=48&crop=1%3A1https://www.datasciencecentral.com/profiles/blog/feed?user=30jh5a5upl495&xn_auth=noA Comprehensive List Of R Packages For Portfolio Analysistag:www.datasciencecentral.com,2018-04-28:6448529:BlogPost:7162192018-04-28T11:30:00.000ZRanjit Mishrahttps://www.datasciencecentral.com/profile/RanjitMishra
<p style="text-align: left;">R language is a free statistical computing environment; hence there are multiple ways/packages to achieve a particular statistical/quantitative output. I am going to discuss here a concise list of R packages that one can use for the modeling of financial risks and/or portfolio optimization with utmost efficiency and effectiveness. The intended audience for this article is financial market analysts interested in using R, and also for quantitatively inclined folks…</p>
<p style="text-align: left;">R language is a free statistical computing environment; hence there are multiple ways/packages to achieve a particular statistical/quantitative output. I am going to discuss here a concise list of R packages that one can use for the modeling of financial risks and/or portfolio optimization with utmost efficiency and effectiveness. The intended audience for this article is financial market analysts interested in using R, and also for quantitatively inclined folks with a background in finance, statistics, and mathematics.</p>
<p style="text-align: left;"></p>
<p style="text-align: left;">Given the rise in the frequency of crises (the frequency of occurrence of financial market crises has certainly increased during the last 18 years or so; since the 1999 bubble burst), the modeling and measurement of financial market risk have gained tremendously in importance and the focus of portfolio allocation has shifted from the <em>average</em> side of the (<em>mean</em><em>, SD</em>) coin to the <em>SD</em> side. Hence, it has become necessary to devise and employ methods and techniques that are better able to cope with the empirically observed extreme fluctuations in the financial markets. Analysts should go beyond the ordinarily encountered standard tools and techniques. It is better to have a larger set of tools (one of them is certainly R language) available than to be forced to rely on a more restricted set of methods.</p>
<p> </p>
<p><strong><u>Exploratory Analysis of Financial Market Data</u></strong></p>
<p>Packages <em>fBasics</em><em>, evir</em> and <em>timeSeries</em> - are used for reviewing the Stylized facts for univariate series. Use these packages for exploratory data analysis such as percentage returns, box plot of returns, autocorrelations, partial autocorrelations and to investigate basic properties of financial returns and related quantities.</p>
<p></p>
<p>Packages <em>mts</em> and <em>zoo –</em> are used for reviewing the Stylized facts for multivariate series. Use these packages to analyze the characteristics of multivariate return series, such as co-movement between multiple equity markets etc. </p>
<p> </p>
<p><strong><u>Modeling For suitable Return Distribution</u></strong></p>
<p>Packages <em>fBasics</em> and <em>GeneralizedHyperbolic</em> – are used for univariate analysis for generalized hyperbolic distribution (GHD) and its special cases, namely the hyperbolic (HYP) and normal inverse Gaussian (NIG) distributions.</p>
<p> </p>
<p>Packages <em>ghyp</em> and <em>QRM</em> – can handle both univariate and multivariate cases for HYP, GHD, NIG and student’s t-distributions. These can also be used to choose the risk measures such as, the standard deviation, the VaR, or the ES, and whether the portfolio should be a minimum risk, a tangency, or a target return portfolio.</p>
<p> </p>
<p>Packages <em>SkewHyperbolic</em> and <em>VarianceGamma</em> <strong>-</strong> <em>SkewHyperbolic</em> is solely for the modelling and fitting of the skew hyperbolic Student’s t distribution. <strong>VarianceGamma</strong> can be considered as a twin package to the <strong>SkewHyperbolic</strong> package, but its focus is on the variance gamma distribution.</p>
<p> </p>
<p>Packages <em>Davies, fBasics, gld</em> and <em>lmomco</em> – are used for the generalized lambda distribution (GLD) for risk modelling and data analysis.</p>
<p> </p>
<p><strong><u>Modeling For Extreme Value Theory</u></strong></p>
<p>Packages <em>evd</em> and <em>evdbays</em> – are used univariate and multivariate parametric extreme value distributions. <em>evdbayes</em> provides functions and methods for the Bayesian analysis of extreme value models, where Markov chain Monte Carlo (MCMC) techniques are utilized.</p>
<p> </p>
<p>Packages <em>extRemes</em> and <em>in2extRemes</em> – use them for distribution models such as the generalized extreme value, the Gumbel, the generalized Pareto, and the exponential distributions. The fit can be accomplished to either block maxima data or the threshold excesses.</p>
<p> </p>
<p>Package <em>fExtremes</em> – use it for data preprocessing, EDA, the GEV distribution, the GPD, and the calculation of risk measures.</p>
<p> </p>
<p>Packages <em>Renext</em> and <em>RenextGUI</em> – they deal explicitly with EVT. A GUI is contained in <em>RenextGUI.</em></p>
<p><em> </em></p>
<p><strong><u>Modeling volatility</u></strong></p>
<p>Packages <em>bayesGARCH, ccgarch, fGarch, GEVStableGarch, gogarch, lgarch (log_garch), rugarch</em> and <em>rmgarch</em> – are a comprehensive suite of packages for GARCH-type models for both univariate and multivariate analysis.</p>
<p> </p>
<p><strong><u>Modeling dependence</u></strong></p>
<p>Package <em>BLCOP</em> – The first two letters in the name, BL, stand for Black–Litterman approach and the last three, COP, are for Copula. Hence, use this package for implementing the Black–Litterman approach to portfolio optimization and the framework of copula opinion pooling.</p>
<p> </p>
<p>Packages <em>copula</em> and <em>fCopulae</em> – use them for broad implementation of the copula concept. Archimedean, elliptical, and extreme value copulae can be implemented.</p>
<p> </p>
<p>Package <em>gumbel</em> – use it solely for Gumbel copula.</p>
<p> </p>
<p><strong><u>Modeling For Robust Portfolio Optimization</u></strong></p>
<p>Package <em>covRobust</em> – use it for implementation of the covariance and location estimator introduced by Wang and Raftery.</p>
<p> </p>
<p>Package <em>fPortfolio</em> – use it for conducting many different kinds of robust portfolio optimization task.</p>
<p> </p>
<p>Packages <em>MASS</em><em>,</em> <em>lattice</em><em>,</em> <em>robustbase</em><em>, robust,</em> <em>rrcov</em> and <em>stats</em> – use these packages for robust estimation for the location vector and scatter, Huber M-estimators, dispersion, minimum covariance determinant, the orthogonalized Gnanadesikan–Kettenring estimators etc..</p>
<p> </p>
<p>Package <em>cccp -</em> The package’s name is an acronym for “cone constrained convex programs” and as such is suitable for solving convex objective functions with second-order cone constraints.</p>
<p> </p>
<p><strong><u>Modeling For Diversification of Portfolio</u></strong></p>
<p>Packages <em>cccp,</em> <em>DEoptim, DEoptimR, and RcppDE, FRAPO</em> and <em>PortfolioAnalytics –</em> use these packages for finding a portfolio allocation which gives equal marginal contributions to the ES for a given confidence level, the diversification ratio, concentration ratio, volatility-weighted average correlation and risk-measure-related approaches to portfolio optimization etc. They can also be used in other optimizations.</p>
<p> </p>
<p><strong><u>Modeling for Risk Optimal Portfolios</u></strong></p>
<p>Packages <em>fPortfolio –</em> use this package for CVaR portfolios (mean excess loss, mean shortfall, and tail VaR), and for producing risk surface plots. Also used for optimizing the minimum-CVaR and minimum-variance portfolios.</p>
<p> </p>
<p>Packages <em>glpkAPI, linprog, lpSolve, lpSolveAPI and Rglpk</em> <strong>- </strong> are used for linear programming. Large-scale linear programs as well as mixed integer programs can be solved.</p>
<p> </p>
<p>Package <em>Rsymphony -</em> provides a high-level interface to the MILP solver SYMPHONY, where the branch, cut, and price approach for solving MILP problems are implemented.</p>
<p> </p>
<p>Package <em>PerformanceAnalytics –</em> contains functions and methods for assessing the performance of a given portfolio allocation and the associated risks.</p>
<p> </p>
<p><strong><u>Modeling For Tactical Asset Allocation</u></strong></p>
<p>Package <em>BLCOP</em> - functions and procedures for the Black–Litterman method. The package also provides functions/methods for determining an optimal portfolio allocation for given prior/posterior distributions.</p>
<p> </p>
<p>Packages <em>dse, fArma, and forecast</em> – use them for model implementations for univariate and multivariate time series. Package fArma can be used to implement different types of ARMA models - AR, MA, ARMA, ARIMA, and ARFIMA.</p>
<p> </p>
<p>Package <em>MSBVAR</em> <strong>–</strong> use it to estimate classical and Bayesian (structural) VAR models and carry out inferential analysis on them.</p>
<p>Packages <em>urca</em> and <em>vars</em><strong> </strong> - use the former for the analysis of integrated and co-integrated time series, whereas the latter for the implementation of multivariate time series models and inferences associated with these.</p>
<p></p>
<p><br/><br/></p>
<p> </p>