PerformanceAnalytics | PerformanceAnalytics provides an R package | Data Visualization library

 by   braverock R Version: v2.0.4 License: No License

kandi X-RAY | PerformanceAnalytics Summary

kandi X-RAY | PerformanceAnalytics Summary

PerformanceAnalytics is a R library typically used in Analytics, Data Visualization applications. PerformanceAnalytics has no bugs, it has no vulnerabilities and it has low support. You can download it from GitHub.

PerformanceAnalytics provides an R package of econometric functions for performance and risk analysis of financial instruments or portfolios. This package aims to aid practitioners and researchers in using the latest research for analysis of both normally and non-normally distributed return streams. We created this package to include functionality that has been appearing in the academic literature on performance analysis and risk over the past several years, but had no functional equivalent in R. In doing so, we also found it valuable to have wrappers for some functionality with good defaults and naming consistent with common usage in the finance literature. In general, this package requires return (rather than price) data. Almost all of the functions will work with any periodicity, from annual, monthly, daily, to even minutes and seconds, either regular or irregular. The package documentation includes sections on. It also includes some thoughts on work yet to be done, acknowledgments, and pointers to other literature and resources in R useful for performance and risk analysis,. Some sample data is provided in the managers dataset. It is an xts object that contains columns of monthly returns for six hypothetical asset managers (HAM1 through HAM6), the EDHEC Long-Short Equity hedge fund index, the S&P 500 total returns, and total return series for the US Treasury 10-year bond and 3-month bill. Monthly returns for all series end in December 2006 and begin at different periods starting from January 1996. That data set is used extensively in our examples and should serve as a model for formatting your data.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              PerformanceAnalytics has a low active ecosystem.
              It has 182 star(s) with 103 fork(s). There are 27 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 56 open issues and 42 have been closed. On average issues are closed in 111 days. There are 3 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of PerformanceAnalytics is v2.0.4

            kandi-Quality Quality

              PerformanceAnalytics has no bugs reported.

            kandi-Security Security

              PerformanceAnalytics has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.

            kandi-License License

              PerformanceAnalytics does not have a standard license declared.
              Check the repository for any license declaration and review the terms closely.
              OutlinedDot
              Without a license, all rights are reserved, and you cannot use the library in your applications.

            kandi-Reuse Reuse

              PerformanceAnalytics releases are available to install and integrate.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of PerformanceAnalytics
            Get all kandi verified functions for this library.

            PerformanceAnalytics Key Features

            No Key Features are available at this moment for PerformanceAnalytics.

            PerformanceAnalytics Examples and Code Snippets

            No Code Snippets are available at this moment for PerformanceAnalytics.

            Community Discussions

            QUESTION

            R Shiny: Creating X numbers of numericInput boxes equal to number of variables
            Asked 2021-May-13 at 12:13

            I'm trying to create a finance-related R Shiny application. As of right now, I have a tab to create a custom portfolio, which requires me to have a numericInput for each variable in the original source_file. This is how the sample source_file looks like:

            Date CSI500 Shanghai CSI300 HSI STI 2016-01-01 +5% -2% +5% +10% +12% 2016-01-08 +3% +13% -8% -3% +10% 2016-01-15 +2% +11% -3% +4% -15%

            Currently, I have to manually hardcode each numericInput box for each variable like shown:

            ...

            ANSWER

            Answered 2021-May-13 at 12:13

            Here is a demo that may be helpful for you.

            You can upload a .csv file to the shiny app. It will ignore the first column (or you can modify to specifically remove a date column).

            The numeric inputs will be dynamically generated based on the header column names read in.

            The demo has a calc button, that will store the input data and for further processing (calculating returns). Also added a table to show the entered data.

            Edit: If upon pressing the calc button you want to call your custom function (calculate_portfolio_returns), you can add the call to that function in eventReactive, since that is dependent on the input button. To pass on the values from the numeric inputs, you can store these values temporarily in a vector vals, and then pass vals as an argument to the function (see modified code below). In the demo, I call a custom function calc_sum that will print the sum of the numeric inputs in the console. One final note, I added an explicit return at the end of input_vals(), so that vals can be shared for use in output$table.

            Source https://stackoverflow.com/questions/67499112

            QUESTION

            R shiny dygraph causing error when deploying?
            Asked 2021-Mar-24 at 02:18

            I have recently changed my plot to a dygraph and even though everything works fine when I run the app locally, I get the error message:

            ...

            ANSWER

            Answered 2021-Mar-24 at 02:18

            I put everything in a single app.R file and it works fine : https://hleviel.shinyapps.io/testapp/

            Source https://stackoverflow.com/questions/66773790

            QUESTION

            R shiny dygraph not rendering
            Asked 2021-Mar-23 at 02:36

            I have decided to change my basic plot() for a dygraph() but the dygraph isn't rendering (even though there is no error message). I have tested dygraphs in R shiny using the documentation and it worked. Could someone help me? Note that if you replace the dygraph at the end of my function with a basic plot(c(1,2),c(2,3)) the plot will render.

            UI

            ...

            ANSWER

            Answered 2021-Mar-23 at 02:36

            The error here is because removeModal() is the last expression of the renderDygraph() block, so it's return in interpreted as the plot while it's the return of RunPlot(...) that contains the plot:

            Source https://stackoverflow.com/questions/66756331

            QUESTION

            R shiny trouble with renderPlot
            Asked 2021-Mar-20 at 11:53

            I am using a function to print a plot. This function will only be called once in order to print the plot to the UI (when I click on the "Go" button). The problem is that the plot only prints to the console and not to the UI. There is no error message. I think there might be a problem with my renderPlot. Here is my code:

            UI

            ...

            ANSWER

            Answered 2021-Mar-20 at 11:53

            You should have the observeEvent outside the renderPlot. To make it not react to changes in tickers, you need to isolate() the reactive variables.

            Source https://stackoverflow.com/questions/66716153

            QUESTION

            R shiny problem calling my function with a button
            Asked 2021-Mar-19 at 02:22

            I have defined a function in the server as " RunPlot <- function(tickers, sharesVec, FromDate, ToDate)". The function should return a single numerical value. I want to output this value by clicking on the button "Go", but when I click on the button, nothing happens. Also, I have tried calling this function in a separate script and everything worked so there is no error inside the function. Here is my code:

            UI

            ...

            ANSWER

            Answered 2021-Mar-19 at 02:22

            Your object BETA is only available inside the observer. One way to make it available outside is to create a reactiveValues object as shown below.

            Source https://stackoverflow.com/questions/66700969

            QUESTION

            How to store text input in a vector to be used later with R shiny?
            Asked 2021-Mar-18 at 03:34

            I want to define two variables ("tickers" and "SharesVec") as empty vectors and add text inputs and numerical inputs (respectively) to these vectors when the button "action" is triggered. I will be using these vectors later to run a function. I'm not sure I understand how to use variables properly in R shiny (beginner). Here is what I tried so far:

            UI

            ...

            ANSWER

            Answered 2021-Mar-18 at 03:34

            Store the vectors in reactiveValues. You can change the server function to :

            Source https://stackoverflow.com/questions/66684107

            QUESTION

            How do I calculate equal weighted portfolio returns with NA using PerformanceAnalytics?
            Asked 2021-Feb-22 at 14:30

            I am struggling to calculate equal weighted portfolio returns. I am currently using Return.portfolio from the PerformanceAnalytics package and I encounter problems when dealing with NAs.

            To give a reproduceable example:

            ...

            ANSWER

            Answered 2021-Feb-22 at 14:30

            I think you encounter this problem, because the weights need be known before the rebalancing, i.e. you can get meaningful values, if you subtract one day from the index of your weights:

            Source https://stackoverflow.com/questions/66291709

            QUESTION

            Optimization code in R, am I missing something?
            Asked 2021-Feb-11 at 23:33

            I'm trying to optimize the parameters of a simple strategy as the code below by maximizing the sharpe ratio. The output results are clearly wrong. Can you please provide some help?

            ...

            ANSWER

            Answered 2021-Feb-11 at 23:33

            optim() and related methods can find optima of smooth surfaces. With only two parameters it's easy enough to compute the objective function over a surface by brute force (I use functions from the emdbook and plot3D packages for convenience, but you could easily do this with for() loops and the built-in persp() function ...) (code below)

            I know nothing about your subject area (finance?) or what's going on under the hood in the objective function, but it's not at all surprising that the optimization didn't work.

            I was concerned that maybe the problem was with non-integer values of the parameters (which would present a problem for optim() in any case, but might suggest other approaches), but even restricting to integer values in the range (5-20, 180-200) we still get a rough-looking surface:

            I have found the DEoptim (optimization by differential evolution) function useful for problems like this.

            Source https://stackoverflow.com/questions/66158077

            QUESTION

            Find start date and end date of non zero rows r dataframe and create a table
            Asked 2021-Feb-11 at 20:24

            rh1 is the sample price dataframe rh2 is returns of rh1 and return_cum is the cumulative returns of rh2 and ret_drawdown computes drawdown.

            ...

            ANSWER

            Answered 2021-Feb-11 at 20:24

            You could split ret_drawdown along the cumsum of the identity of zero-valued dates. In S filter out the zeroes. In an lapply make data.frames out of min and max date of the index of the time series as well as the sum of a and rbind and do some rownames cosmetics. In a last step we calculate cumsum within the resulting data frame.

            Source https://stackoverflow.com/questions/66157885

            QUESTION

            Changing the value in a rank given a condition
            Asked 2021-Jan-19 at 22:04

            I am trying to transform a table of stocks ranked by their return to a matrix of values that would be inputted to PerformanceAnalytics::ReturnPortfolio as the weights of the stocks in the portfolio.

            What I am specially looking to do is to transform the ranking value of the 33% best stocks to 1, the 33% worst-performing stocks to -1 and the rest to 0.

            This is the original code where I am just taking the best stocks and changing their ranked value to 1:

            ...

            ANSWER

            Answered 2021-Jan-19 at 22:04

            We could loop over the rows with apply and MARGIN = 1, get the quantile with probs as .33 and .67, pass that as breaks in the cut, convert to integer and use that index for replacing the values to 1, 0, -1

            Source https://stackoverflow.com/questions/65798539

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install PerformanceAnalytics

            You can download it from GitHub.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/braverock/PerformanceAnalytics.git

          • CLI

            gh repo clone braverock/PerformanceAnalytics

          • sshUrl

            git@github.com:braverock/PerformanceAnalytics.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link