[R] Cost-benefit/value for money analysis
Ben Bolker
bbolker at gmail.com
Wed Jan 5 03:03:35 CET 2011
Graham Smith <myotistwo <at> gmail.com> writes:
>
> 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.
>
> 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.
>
> I know that some specialist decision analysis software does this sort of
> thing, but was hoping R might have an appropriate package.
Perhaps you can specify your question more precisely, or differently.
The way I interpret it, if there are no interactions in price
(e.g. you get a discount for buying more than one book at a time)
or in value (e.g. you learn more from one book having read another),
then you get the best value/price ratio by taking only the book with
the highest value/price. (If you take no books at all, your value/price
ratio is undefined.) The algebra below shows that combining a lower
value/price book with a higher one always lowers your overall value/price
ratio.
If you redefine your problem, you might find the combn() or
expand.grid() functions, along with various versions of apply(), to
be useful. If you have too large a search space you might take a look
at the simulated annealing (SANN) option of optim().
===================
if a1/b1 > a2/b2 (1)
and a1, b1, a2, b2 > 0
show
a1/b1 > (a1+a2)/(b1+b2) (2)
i.e.
a1/b1 - (a1+a2)/(b1+b2) > 0
or
(a1(b1+b2)-(a1+a2)b1)/(b1+b2) =
(a1*b2-a2*b1)/(b1+b2) > 0
the numerator is (a1*b2-a2*b1):
(1) implies that a1*b2>a2*b1
so the numerator is positive
qed
More information about the R-help
mailing list