Currently, I am need of a function that solves for Aumann-Serrano riskiness. AS riskiness is a favorite academic paper of mine, and it establishes a new measure of riskiness developed in response to the financial crisis.

AS Riskiness supposes for each gamble $g$, there exists a unique positive number $R(g)$ that satisfies ${\rm{E}}{e^{ - g/R(g)}} = 1$

There are a few conditions though:

• Gambles must have a positive expected value (you can't use it at Vegas)
• Gambles must include one negative outcome (you must have skin in the game)

In exchange for these restrictions, one gets a measure of risk that is strictly monotone with respect to stochastic dominance. Additionally, a paper in 2011 by Homm and Pigorsch (link) established an economic performance measurement similar to the Sharpe Ratio, but one that excels at situations in which returns are not normally distributed (such as the 2008 GFC). In my classes, I did an initial exploration of the relation of returns and AS riskiness and found that the tendency of AS riskiness to rapidly respond to losses does have advantages for risk-conscious investors. See the shape of AS risk vs. Return below:

SP500 Component AS Risk vs Return for 2010

For future investigation, I want to have an R function that calculates AS riskiness, so my prototype is as follows:

-Name: asRisk()
-Input: vector of returns in percent
-This makes it easy to use the function with quantmod
-Also more versatile
-Dependencies/Requirements: none
-One possible way to solve for AS risk is to use an R package with a solver, such as ROI
-I would rather not have any dependencies, as my need for precision isn't very high
-Precision: 1/1000
-Method: Iterative from 0.0001 to 1000
-The program will give up at 1000, as the function goes out to infinity as returns approach zero
-In most cases, our risk scores are much much lower, so any sane situation should have no problem with this
-If this method is too slow on modern computers (unlikely), I will consider moving to a solver package
-Error Checking: We will check for
-Negative overall return (return Error)
-No negative outcomes (return Error)
-Failed sanity check, AS Score > 1000 (return Warning)
-Output: AS risk score

This will be my first R function other than "Hello, World!", so I am going to try to keep the solution as simple as possible.  Once I have a solid foundation with my current solver, I will attempt to work towards using option chains to counteract the negative overall return error, and potentially to use a solver.  The simple version will be a large improvement over Excel though, with its floating point errors that are a huge source of errors with large numbers of observations.