[R-SIG-Finance] Cost-benefit/value for money analysis

Joshua Ulrich josh.m.ulrich at gmail.com
Tue Jan 4 20:45:34 CET 2011


This really doesn't have anything to do with finance, but I was bored
waiting for something to run.  Please direct any questions to me
off-list or to R-help, since this is not on-topic for this list.

On Tue, Jan 4, 2011 at 12:54 PM, Graham Smith <myotistwo at gmail.com> wrote:
> Posted on R-help, but it has been suggested that I also post here.
>
> I assume this has a "proper" name, but I don't know what it is and wondered
> if anyone knew of a package that might do the following, or something
> similar.
>
> As an example, assume I have borrowed and read 10 books on R , and  I have
> subjectively given each of them a "value" score in terms of how useful I
> think they are. I also know how much each costs in terms of money.
>
set.seed(21)
p <- trunc(runif(10)*100) # prices
v <- trunc(runif(10)*10)  # values

> What I would like to do is to calculate the costs of every possible
> combination of the 10 books, and plot the total monetary value for each of
> these possible combination  with their associated subjective value totals,
> to help decide which combination of books represents the best value for
> money.
>
bk <- letters[1:10]    # books
nb <- 3                # number of books to choose
pc <- combn(p,nb,sum)  # price combinations of 3 books
vc <- combn(v,nb,sum)  # value combinations of 3 books
bc <- combn(bk,nb)     # books in each combination

plot(vc/pc)            # value for money
bc[,which.max(vc/pc)]  # best combination of value for money

> I know that some specialist decision analysis software does this sort of
> thing, but was hoping R might have an appropriate package.
>
Everything above was done with the base R packages.

Best,
--
Joshua Ulrich  |  FOSS Trading: www.fosstrading.com


> Many thanks,
>
> Graham
>
>        [[alternative HTML version deleted]]
>
> _______________________________________________
> R-SIG-Finance at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only. If you want to post, subscribe first.
> -- Also note that this is not the r-help list where general R questions should go.
>



More information about the R-SIG-Finance mailing list