PerformanceAnalytics
repository·master·Indexed 42 days ago
https://github.com/braverock/performanceanalyticsAn R package providing econometric tools for the performance and risk analysis of financial instruments and portfolios, supporting both normal and non-normal return distributions. It is designed to work with xts objects and return data across various periodicities.
What's inside PerformanceAnalytics
- PerformanceAnalytics is an R package providing econometric functions for the performance and risk analysis of financial instruments and portfolios. It is designed to support both normally and non-normally distributed return streams, incorporating recent academic research into functional R tools. The package provides wrappers with sensible defaults and naming conventions consistent with finance literature.
Use table.Performance() to summarize return metrics
masterThe
table.Performance()function is used to summarize return metrics, including risk, performance, and statistics. It allows users to select specific metric sets and modify optional arguments (such as the risk-free rate) via an interactive data editor window within the R console.Key features include:
- Metric Selection: Choose specific sets of risk and performance metrics.
- Interactive Editing: Modify parameters like the risk-free rate in a limited interactive window.
- Exporting: Supports exporting via the
exportFun=TRUEargument. - Formatting: Supports LaTeX output and interactive modes (use
interactive=FALSEto disable the interactive window).
Data requirements for PerformanceAnalytics
masterWhen using PerformanceAnalytics, ensure your data meets the following requirements:
- Return Data: The package generally requires return data rather than price data.
- Periodicity: Functions are compatible with various periodicities, including annual, monthly, daily, and even minute/second intervals. These can be regular or irregular.
- Data Format: The package works well with
xtsobjects. Using the providedmanagersdataset as a model can help you format your own data correctly.
Explore PAenhance package documentation and functions
masterOnce
PAenhanceis installed, you can use standard R commands to inspect the package contents:- Main Help Page: View the comprehensive documentation.
- Package Description: Get a short description of the package.
- List Functions: See all exported functions available in the
PAenhancenamespace.
# Get main help page help(package = "PAenhance") # Get short description packageDescription("PAenhance") # List all functions in the package ls("package:PAenhance")Install PAenhance from GitHub
masterTo install the latest development version of
PAenhance, use thedevtoolspackage to install directly from GitHub. After installation, load the library usinglibrary(PAenhance).install.packages("devtools") library(devtools) install_github("kecoli/PAenhance") library(PAenhance)Use the managers dataset for examples
masterThe package includes a
managersdataset which is anxtsobject. It serves as a model for formatting your own data and is used extensively in the package examples. It contains monthly returns for:- Six hypothetical asset managers (
HAM1throughHAM6) - The EDHEC Long-Short Equity hedge fund index
- The S&P 500 total returns
- US Treasury 10-year bond total returns
- US Treasury 3-month bill total returns
- Six hypothetical asset managers (