Write a function that can be used as the
utility argument in
You need R.
There are requirements on the arguments and on the output.
The first argument should expect a random portfolio object. It is traditionally called
The second argument should be called
There can be as many additional arguments as you like, with or without default values.
The output needs to be a numeric vector that is as long as the input random portfolio object. (And obviously each value in the output should be for the corresponding random portfolio.)
All of the utility functions in
pprobeSup use the
valuation function from Portfolio Probe, and hence the
scenarios argument must be a matrix or a three-dimensional array of prices. But there is no reason that
valuation has to be used and hence no reason that
scenarios must look anything like an array of prices.
scenario.optimizer presents the utility function a set of portfolios. It then uses the result to select the portfolio in the set with the best utility.
pputil.multomega is an example of combining utilities from multiple times.
pputil.valueWt is an example of allowing scenarios to have different importances.